Best way to clear a bound UltraGrid without emptying the dat

Posted by jblitzie on 30-Mar-2011 11:28

I have an UltraGrid bound to a ProDataSet via Progress.Data.BindingSource. I progressively build data in the temp-table but only show a subset of that data in the grid and any particular time.

What I would like to be able to do is clear the data in the grid without deleting all the data in the dataset. I've been opening a query such as "for each tablename where false" against the TOP-NAV-QUERY. That works but is probably not the most effecient.

I tried the following, but received an error about repositioning.

    httQryHandle = hDataSet:TOP-NAV-QUERY(1).

    httQyHandle:CLOSE-QUERY( ).

I also tried

      myBindingSource:HANDLE:TOP-NAV-QUERY:QUERY-CLOSE().

It cleared some of the data in the grid but the blank rows were still there. I refreshed both the grid and the bindingsource as well.

Is there something I'm missing that would work in this case?

Regards,

Jim

All Replies

Posted by Admin on 30-Mar-2011 11:36

"for each tablename where false" against the TOP-NAV-QUERY. That works but is probably not the most effecient.

I sometimes use

FOR/PRESELECT EACH tablename WHERE ROWID (talbename) = TO-ROWID ('0x0')

Posted by Peter Judge on 30-Mar-2011 11:46

PRESELECT EACH tablename WHERE ROWID (talbename) = ?

also works.

-- peter

Posted by jblitzie on 30-Mar-2011 12:04

Hmmm.

I was hoping for something on the bindingsource or grid that would clear the current result set like BindingSource:Clear( ).  The clear method does exist but is not implemented.

Thanks though. Using the rowid is probably a bit faster.

Posted by Peter Judge on 31-Mar-2011 08:37

Jim,

Rereading your original post I got to wondering whether there's not a bug there - if you close the query, the PBS should tell the grid that there's no data to show. It might be worth speaking to TS about that. And if the Clear() method isn't implemented, then you could log that too.

-- peter

Posted by jblitzie on 01-Apr-2011 07:47

Peter, thanks.

I can definitely do that.

This thread is closed