Two questions re addFoundSetFilterParam

My solution will host several completely different client companies. The current client company is recorded into a global when the user logs in. That user, from this point on, should only see records related to that client company, in other words records created by themselves and/or colleagues.

Here’s a typical filter:```
controller.addFoundSetFilterParam(‘client_id’, ‘=’, globals.gclient_id);


1. I've been assuming that these filters need only be set once when Servoy Server is started and will therefore apply to all users no matter what company they work for. Is this logic correct? If so, how do I run an opening script for Servoy Server that does **not** also run when Servoy Client is run?

In my development environment I've discovered setting these filters (one for each form) takes a while on startup, delaying user access.

2. I've also discovered controller.loadRecords(relationship) ignores the filter and loads **all** records which satisfy the relationship **unless** the relationship also includes the global.client_id = client_id specification.

I'm surprised. Should I be? I've been under the impression the filter is absolute in all circumstances as long as the solution is running.

Kind regards,

I’ve been assuming that these filters need only be set once when Servoy Server is started and will therefore apply to all users no matter what company they work for.

As far as I understood this, the filters need only be set once per client session. It has nothing to do with the server. The server doesn’t do anything, here.

In my development environment I’ve discovered setting these filters (one for each form) takes a while on startup, delaying user access.

That’s no suprise, I think. The worst about doing that is probably that you need to load all forms on startup, no matter if the user ever gets to see a certain form. This is exactly what you have the onLoad property of a form for. Once somebody actually wants to see that form the first time, your method gets fired.

I’ve also discovered controller.loadRecords(relationship) ignores the filter

That’s true as far as I know and I also dislike that. I made a suggestion for a better implementation of foundSetFilters here: Pledge for more power to the developer :) - Classic Servoy - Servoy Community

But I think the dev team is pretty busy doing other stuff, right now. :)

To summarize then:

  1. The filters are for the current user’s session, not as I’d been assuming until now, neutrally across the whole of the solution. Haven’t seen that explicitly stated anywhere (or I just simply missed it).

  2. Apply the filter via the form’s onLoad rather than as part of the solution startup script.

  3. controller.loadRecords(relationship) is a “hole” in the wall, needs to be plugged in the relationship.

Thanks Patrick.

I wonder if someone at Servoy would mind explaining why the setFoundSetFilterParam command can only be set once per user session? Would it be very complicated to allow it to be changed during a session? This would certainly increase its usefulness.