Question

I have a strange problem on form: I added a range to filter records in datasource executeQuery() method, this works fine when opening form but if I set manually a filter in the grid header, the range set in ExecuteQuery() method are not applied. My ranges are definied as follow :

this.query.dataSourceNo(1).AddRange(fieldnum(MyTable,MyField)).Value('MyRangeValue');

I use a view as form DataSource, May be it's the problem. Any ideas to always apply ranges and keep it even when manually add filters on grid? Thanks for your help

Était-ce utile?

La solution

You must apply the filter before the super() in executeQuery().

But I think your problem is you add the filter every time the executeQuery() is run, resulting in an OR in the SQL expression generated.

This is the way to do it:

QueryBuildRange qr = SysQuery::findOrCreateRange(this.query.dataSourceNo(1), fieldnum(MyTable,MyField));
qr.value(queryValue('MyRangeValue'));
qr.status(RangeStatus::Locked); // Or ::Hidden
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top