Batching, Sorting, Filtering etc. + UltraGrid

Posted by vrtik on 31-Mar-2011 04:56

Hi all
I'm having couple of problems with applying filtering and batching. If you could help that would be great.
I downloaded Havards sample which helped a lot. Thanks Havard.
1. Problem with custom filter. Havard suggests to take over the dialog in BeforeCustomRowFilterDialog. Thats fine but unfortunatelly when
i try to call CustomRowFiltersDialog (wait-for e:CustomRowFiltersDialog:ShowDialog(filter,?) set dResult ) i'm getting an error System.ArgumentException: You can only call ShowDialog as part of a WAIT-FOR statemen. (15574). Any idea how this problem can be solved - workaround?
2. Is there a newer version of Havards sample than from 2009?
3. How do you solve the problem with adding/deleting record while the batching is on? When i add the new record batching stops working (OffEnd doesn't fire anymore). The only way i know about how to solve this is reopen query or to do something like this:
oBindingSource:HANDLE = ?.                    
oBindingSource:HANDLE = hDataSetHandle:HANDLE.
In this case i lose focus to the new created record.
Regards
Peter

All Replies

Posted by vrtik on 31-Mar-2011 05:01

OE version is 10.2B03
i'm sorry for formatting.

Posted by Peter Judge on 31-Mar-2011 07:49

vrtik wrote:

2. Is there a newer version of Havards sample than from 2009?

Nothing right now, that I know of, but we're planning to add / complete batching support to the AutoEdge|TheFactory sample (http://communities.progress.com/pcom/community/psdn/openedge/architecture/autoedgethefactory).

3. How do you solve the problem with adding/deleting record while the batching is on? When i add the new record batching stops working (OffEnd doesn't fire anymore). The only way i know about how to solve this is reopen query or to do something like this:

oBindingSource:HANDLE = ?.                    
oBindingSource:HANDLE = hDataSetHandle:HANDLE.
In this case i lose focus to the new created record.

I create the TT record, reopen the query, reposition to the newly-created record and update. You have to reopen the query before the BindingSource sees the new record (or records, for batching). Setting oBS:Handle = ? and = hDS:Handle reopens the query. I would suggest opening the query "normally" (ie hQuery:query-close(). hQuery:query-open()).

-- peter

Posted by Håvard Danielsen on 31-Mar-2011 10:04

1. Problem with custom filter. Havard suggests to take over the dialog in BeforeCustomRowFilterDialog. Thats fine but unfortunatelly when
i try to call CustomRowFiltersDialog (wait-for e:CustomRowFiltersDialog:ShowDialog(filter,?) set dResult ) i'm getting an error System.ArgumentException: You can only call ShowDialog as part of a WAIT-FOR statemen. (15574). Any idea how this problem can be solved - workaround?

I have not looked at this lately, but it seems wrong that you get this error when you actually are using a wait-for. It could posibly be some version incompatibility with current Infragistics version.  If you have a reasonable duplicatable example you should contact Support. (I guess my sample can be categorized as reasonably duplicatable, but I'm sure they'd appreciate if you could narrow it down further.)

Posted by Håvard Danielsen on 31-Mar-2011 10:52

3. How do you solve the problem with adding/deleting record while the batching is on? When i add the new record batching stops working (OffEnd doesn't fire anymore). The only way i know about how to solve this is reopen query or to do something like this:
oBindingSource:HANDLE = ?.                    
oBindingSource:HANDLE = hDataSetHandle:HANDLE.
In this case i lose focus to the new created record.
Regards
Peter

As Peter Judge points out this will require a reopen. When you are batching this means that you need to issue a new server request. The new record may belong in a different batch, so the request needs to be a position request for the new record. The sample code tries to illustrate how to manage and implement position requests while batching (including open and reposition of the query both on server and client). I do not know exactly why OffEnd stops firing, but it is not very surprising since the bindingsource would not know where the end is anymore.

Deletes may require that you keep track of the record that you will position to after the delete and then do a position request for that. As long as you don't delete the last or first record in the batch you may be able to manage deletes on the client. (You can actually also manage delete of first and last locally, since the batch context is pointing to the records outside of the batch, but the behavior will easily become awkward depending on where you want to position after a delete, and at some point you will also run out of records)    

Sorting and filtering adds additional requirement to updates, as any update or create can change the record's postion in the sort and also end up being outside the filter criteria.

Message was edited by: Havard Danielsen
Added notes in parenthesis

Posted by rbf on 31-Mar-2011 16:16

pjudge wrote:


I create the TT record, reopen the query, reposition to the newly-created record and update. You have to reopen the query before the BindingSource sees the new record (or records, for batching). Setting oBS:Handle = ? and = hDS:Handle reopens the query. I would suggest opening the query "normally" (ie hQuery:query-close(). hQuery:query-open()).

You don't even need to close the query before reopening it.

According to the docs of "If you do not explicitely close a query, it is closed when another OPEN QUERY statement is executed for the same query name."

Although it does not state it explicitly in the docs, in my experience this applies to dynamic queries as well.I think this should be added to the docs.

P.S. There *is* another quite useless remark in the documentation of QUERY-OPEN():

"Once you perform QUERY-PREPARE on a query object, you can perform QUERY-OPEN on
it multiple times as long as you do not reperform QUERY-PREPARE. Once you reperform
QUERY-PREPARE, you must reperform QUERY-OPEN."

Posted by Admin on 01-Apr-2011 01:06

P.S. There is another quite useless remark in the documentation of QUERY-OPEN():

 >

"Once you perform QUERY-PREPARE on a query object, you can perform QUERY-OPEN on

it multiple times as long as you do not reperform QUERY-PREPARE. Once you reperform

QUERY-PREPARE, you must reperform QUERY-OPEN."

I wouldn't say it's useless. QUERY-PREPARE is relatively expensive, because this analyses the query string. The fact that you don't need to execute QUERY-PREPARE before each QUERY-OPEN is very helpful.

Posted by vrtik on 01-Apr-2011 05:11

Thank you Havard

I already contacted progress support. They can reproduce the error message so as soon as i know anything new fromthem i will post it here.

It looks like that the only thing i can do now is to try to create our own Custom filter dialog.

Peter

Posted by vrtik on 01-Apr-2011 05:34

Thanks, it's good to know about this.

Posted by vrtik on 05-Apr-2011 07:34

Dear Peter,

Investigating this issue further on our end, the error "System.ArgumentException: You can only call ShowDialog as part of a Wait-For statement. (15574)"  in this case actually is triggered by a bug in the OpenEdge client. Specifically, the client fails to resolve a chained reference correctly, and fails to evaluate the wait-for statement as a result.

This is now  logged as bug# OE00206328.

To work around the occurrence found in the batching sample from Haavard 's webinar, you 'll want to modify the batching\MyApp\client\View\MyGrid.cls. In the method ultraGrid1_BeforeCustomRowFilterDialog, the line:

wait-for e:CustomRowFiltersDialog:ShowDialog(filter,?).

Should be replaced with:

define variable tempref as Infragistics.Win.UltraWinGrid.CustomRowFiltersDialog.
tempref = e:CustomRowFiltersDialog.
wait-for tempref:ShowDialog(filter,?).

This will break up the reference chain in a way that will be handled correctly.

This thread is closed