AddTableFilterParam() problem

It looks like the AddTableFilterParam() is not working when calling records with controller.loadRecords and a custom SQL.

We apply the addTableFilterParam() on solution start. On some forms we use the controller.loadRecords with a custom SQL like: controller.loadRecords(“SELECT a FROM b WHERE a=?”,[newValue]);
The filter is not applied on this custom SQL. U can see in the server log that it doesn’t add the filter parameter.

We are on Version: 5.2.8 - build 1016

I always thought this worked OK, but now I am not sure that I missed something while testing with sample data or that this problem arrised with one of the latest updates with Servoy.

Sem,

I just tried a small sample and it worked as expected, this was the sql that was fired:.

select pk from tab where pk in (<customselect>) and <filtercondition> order by pk asc

Can you try a small sample?

Rob

Hi Rob,

Ok, i’ve made a sample solution of our situation. I was mistaken in where the problem occured. It isn’t the controller.loadRecords query, but actually a global method that fills a valuelist.
The query in the global method for getting valuelist values doesn’t get the filter. See attached sample solution, where the type_ahead field (used as a selector of records) shows all records without the filter.

filter_test.servoy (69.9 KB)

Sem,

You are using databaseManager.getDataSetByQuery() which is not controlled by table filters (as is the rawsql plugin).
Foundset loading is filtered, but these custom queries are executed as-is.

Rob

Ah ok :) That explains it!

I thought that using addTableFilterParam() would add the filter to all used SQL queries. Good to know that there is an exception.