Page 1 of 1

TableFilters Reload

PostPosted: Mon Jul 31, 2006 4:03 pm
by bubba
I would like to have a way to reset a Table filter without having to log into and out of the program. Or alternatively, a way to perform a login and logout proceduraly without exiting the main program.

Would also appreciate documentation on exactly how the table filters work and when they take effect.

Regards,
Lee Snover

PostPosted: Mon Jul 31, 2006 4:11 pm
by patrick
Currently, you can't remove a filter once it is set.

When you set a table filter, the criteria that you passed will be automatically added to every query that Servoy fires against the table. So if you set a filter like 'city=london' and you manually search for a city called 'birmingham', the query will look like

'SELECT address_id FROM addresses WHERE city = 'birmingham' and city = 'london'

The last part is added by Servoy. The results of this query will be 0 of course and that's exactly what you wanted when you specified the filter.

Hope this helps.

PostPosted: Mon Jul 31, 2006 4:21 pm
by bubba
patrick wrote:Currently, you can't remove a filter once it is set.

When you set a table filter, the criteria that you passed will be automatically added to every query that Servoy fires against the table. So if you set a filter like 'city=london' and you manually search for a city called 'birmingham', the query will look like

'SELECT address_id FROM addresses WHERE city = 'birmingham' and city = 'london'

The last part is added by Servoy. The results of this query will be 0 of course and that's exactly what you wanted when you specified the filter.

Hope this helps.


Exactly, and that's the problem. I want to use the TableFilter to do record level security and some users I need to be able to change that security while they are in the program. I don't want to have to make them exit and restart the program.

Thanks,
Lee

PostPosted: Mon Jul 31, 2006 5:12 pm
by ROCLASI
Hi Lee,

At the moment you can't remove tablefilters (nor foundset filters) once they are set.
If you really need more dynamic filtering then you need to handle all the queries yourself. A bit of a pain, but doable.

I would suggest you add your feature request to the bugbase as well (as a feature request ofcourse) so it won't be lost in the sea of forum messages.

Hope this helps.

PostPosted: Mon Jul 31, 2006 5:21 pm
by bubba
Robert:

Thanks.

I understand I can do this myself, but that defeats the purpose of using a 4GL. This functionality exists and works well in Filemaker, and actually in Oracle itself as that is our primary DB. However, to use it in Oracle requires specific Oracle user logons, which is prevented by how Servoy interfaces with the database.

It seems like this would be a relatively trivial feature to add, and would save much work and aggravation for developers.

Regards
Lee

PostPosted: Mon Aug 27, 2007 10:17 pm
by JDW
Agreed. removeTableFilterParam and removedFoundsetFilterParam would both be very useful.

Since they would be accessible only by the programmer developing the application seems these additions would be of limited security risk for those using filters to hide data.

Related post: http://forum.servoy.com/viewtopic.php?t=2345

JW

PostPosted: Mon Sep 10, 2007 10:52 am
by martinh
As I understood the table filters can not be removed while you are logged on. But for foundset filters I agree. I already faced the same situation where I needed to remove the foundset filter, because I wanted to do a reload based on a new filter, but unfortunately my new filter was concatenated with the existing filter.

I can imagine that the new foundset filter will only be active when you do a new loadRecords(). As far as I can see, this will be good enough for me.

PostPosted: Tue Sep 11, 2007 8:33 am
by rgansevles
All,

A new method removeTableFilterParam is planned for Servoy 4.
Unfortunately, we cannot implement this in 3.5 easily.

Rob

PostPosted: Tue Sep 11, 2007 8:54 am
by martinh
Including also removedFoundsetFilterParam ?

PostPosted: Tue Sep 11, 2007 10:09 am
by olivier melet
rgansevles wrote:A new method removeTableFilterParam is planned for Servoy 4.


Great! We thought it would never happens (first request for such a feature in 2004 if I remember well!).

Thank you servoy!

PostPosted: Wed Sep 12, 2007 8:53 am
by rgansevles
martinh wrote:Including also removedFoundsetFilterParam ?

Probably not, the filter is used only during the lifetime of the foundset anyway.

Rob

TableFilters should work on INSERT statements

PostPosted: Tue Sep 18, 2007 3:23 pm
by martinh
TableFilters are very useful. For example in my case where in my database I have records for several companies/administrations in one single database.

By login into a company I set the tablefilter and only the records for that company are selected. Great .... but ....

This tablefilter is not working on INSERT statements. So I have to program in each form now that my company_id must be filled with the company_id of the company where I logged in.

It would be very logic that if there is a tablefilter on a certain table, that the tablefilter is also used on INSERT statements.

The best way to do this, seems to me that when a newRecord() method is triggered on a form(so on a foundset) that the value from the table filter will be filled into the foundset. In that case you have the possibility as a programmer still to change this value.

PostPosted: Tue Sep 18, 2007 3:35 pm
by pbakker
That will not work, because a TableFilter is capable of filtering on multiple values (using the In operator). What should be inserted then?

You should do this with the auto enter options available in the dataprovider dialog.

For example, you can do a lookup from a global variable which would contain the owner_id/company_id of the user that is logged in.

Paul