Greetings. New to Servoy - have done some Access and FMP development in the past.
I would like to filter out the “obsolete” parts in my table that is connected to my Servoy form - and only display (and make available for editing) the “active” parts. In Access I would write a query and base my form on that. I cannot find how to accomplish this in Servoy.
Any ideas or pointers to the place in the documentation that explains how to do this?
Regards, Jay
There is several ways: if you need a permanent “filter”, have a look at controller.addFoundSetFilterParam
If you get more specific, I can teel you more.
on form level you can limit your foundset. (also when user performs a search)
When you’re in the editor, having a method opened,
you can rightclick on a function and select/move sample code into
your method.
//Add a filter parameter to limit the foundset permanently
var success = currentcontroller.addFoundSetFilterParam(‘customerid’, ‘=’, ‘BLONP’);//possible to add multiple
currentcontroller.loadAllRecords();//to make param(s) effective
Thank you both. Now I am getting going.
I have successfully filtered my foundset. Now I want to Show All Records.
I added a button to my form and attached a Method:
controller.loadAllRecords();
elements.headerCompanyText.text = ‘cool’;//just to see if the method is working.
The text changes, however the filter is not removed and all records are not shown.
I tried adding ShowRecords() but no luck. Ideas? Thanks!
BTW - I am using the CRM database, companies form for these tests.
Jay
addFoundSetFilterParam sets a permanent filter after it’s been triggered.
(you’ll need to restart in order to disable)
Have a look at the search filters in the actions list of the demo crm.
With that approach you could do something like this:
- put a global checkbox named “showObsolete” in the top of your list.
- put more global search boxes in the top of your list, eg. companyFilter
filterScript:
controller.find();// start creating find request
if(globals.showObsolete==1)"// add this search parameter if "showObsolete" is checked
{
status = "obsolete"
}
if(globals.companyFilter)// add this search parameter if something is entered
{
company = globals.companyFilter
}
...etc...
controller.search(); //perform the find request
Additionally you could add an initialising script to the onLoad event (only triggers when form is loaded first time) that sets the globals.showObsolete to 0 and performs the script mentioned above.
onLoad script:
globals.showObsolete = 0
filterScript(); // perform subscript