Page 1 of 1

FoundSetFilterParam - Empty Data on subsequent form openings

PostPosted: Fri Sep 30, 2016 2:43 pm
by bobm
I'm using the addFoundSetFilterParam in the onLoad event so that filters the so that the data displayed is only some records.

foundset.addFoundsetFilterParam("table_id", ">",1234

The form opens fine the first time, when I go back to that form later the data is empty.
I'm sure the resolution would be to put the filer someplace else, I'm just not sure where?

Thanks,
Bob

Re: FoundSetFilterParam - Empty Data on subsequent form open

PostPosted: Fri Sep 30, 2016 3:07 pm
by mboegem
Hi Bob,

pls have a look here:
https://wiki.servoy.com/display/public/DOCS/JSFoundSet#JSFoundSet-addFoundSetFilterParam(dataprovider,operator,value)

Add a filter parameter that is permanent per user session to limit a specified foundset of records. Use clear() or loadAllRecords() to make the filter effective. Multiple filters can be added to the same dataprovider, they will all be applied.


So I wouldn't place that in the onLoad, but rather do that upfront, then call clear() / loadAllRecords(), then goto the form.

Re: FoundSetFilterParam - Empty Data on subsequent form open

PostPosted: Fri Sep 30, 2016 4:42 pm
by bobm
Thank you once again Marc!
Bob

Re: FoundSetFilterParam - Empty Data on subsequent form open

PostPosted: Fri Sep 30, 2016 6:05 pm
by Bernd.N
We use foundsetFilterParam a lot and found it very powerful. We call it right after the user logged in in our onOpen() method.
There should be an index on the field that it filters to speed things up.

One has to hold in mind that directSQL still can access the data.
It is not a good idea to use the "IN array" construct when the array is very large, that slows down the app very much.
But using "ID IN select-expression" is very fast when the select works on an indexed field.