Filtering FoundSet

Hi, the databaseManager.addTableFilterParam() method is used to filter the number of FoundSet’s records. Do we have a function which filters the number of columns in a FoundSet? For example, if I’d like to hide the first_name column in a Person table, the FoundSet should display the first_name property as null.

I tried converting the FoundSet to a DataSet and removing the columns manually, but is it possible to convert it again to a FoundSet where the columns will be filtered?

Servoy has the possibility to really hide a column completely when in the designer.

But why do you want to do that exactly on runtime? If you don’t show it anywhere on screen it is not there.

The Servoy form is not the only way to display FoundSet data. Our users can use our report designer to extract any information in our system as long as it is in the FoundSet. At runtime the system should determine if the user is allowed to see the specific field/column or not.

Hi Johan,

If we still don’t have this functionality in the databaseManager.getFoundSet();, is it possible to make a feature request for this?

Something like databaseManager.getFoundSet(,

, <excluded_columns_list>);

I was browsing through the Servoy source codes, it might work if the following changes are done:

  1. Update method in JSDatabaseManager.java
    Add public FoundSet js_getFoundSet(String serverName, String tableName, String excludedColumns) throws ServoyException
  2. Update method in IFoundSetManagerInternal.java
    Add public IFoundSetInternal getNewFoundSet(String dataSource, List defaultSortColumns, String excludedColumns) throws ServoyException;
  3. Update method in FoundSetManager.java
    Add public IFoundSetInternal getNewFoundSet(String dataSource, List defaultSortColumns, String excludedColumn) throws ServoyException
    Update “public IFoundSetInternal getNewFoundSet(String dataSource, List defaultSortColumns) throws ServoyException” to reference previous function
  4. Change SQLGenerator.java
    Add public synchronized SQLSheet getCachedTableSQLSheet(String dataSource, String excludedColumns) throws ServoyException
    Update public synchronized SQLSheet getCachedTableSQLSheet(String dataSource) throws ServoyException to reference previous function

Let me know if there is a better way to do this.

Thanks!

But then we have for the same datasource different SQLSheets, that needs to be checked then in all those places

I guess what you could do is just wrap a IFoundset in something of yourself that does that filtering…

Sounds like you should use a SQL View and give your users access to the views for reporting.

Thanks for the reply. We can’t use views as we have dynamic set of rules, which will created unreasonable number of views in the database.

Easier way is to parse the jrxml file before it gets compiled and remove columns which are restricted for the logged user.

Thanks for all the tips!