Valuelists global relation or query

Hi,

We are using valuelists that are populated when the users enters “edit mode” (button) in a form.

I can populate theses valuelists using global relations or using sql queries.
I am not sure which of the two is preferred with regard to performance.
Any ideas ??

Regards,

Hans

Hi Hans,

in the end, everything ends up being a query in Servoy.
It will depend on the complexity which one to choose.

If you’ll choose for the query, use prepared statement as this will increase performance and is less a safety issue.

Hope this helps

Thanks Marc,

I agree that in the end both result in the same query, so for the database there is no difference.

I wonder if there is a difference in the way Servoy handles both. Caching or ??

Regards,

Hans

Hans Nieuwenhuis:
I wonder if there is a difference in the way Servoy handles both. Caching or ??

Hi Hans,

yes there is!
If you are using table/foundset filters in your solution: those will be respected by Servoy when using a relation.

Let’s say you have a table filter on table person, column tenant_id.
Your global relation could be: globals.find_field = person.firstname
Servoy will query something like: select * from person where firstname = ? and tenant_id = ?

Doing this all by yourself in a query you should also respect the tenant_id, because unlike the relation, servoy won’t add the tenant_id to the where-clause.

What I mentioned earlier that it will depend on the complexity of what you want to build and of course (part of that as well) the control you want to have over certain actions. Editing a global field of global relation will result in a direct query of Servoy.
If you do the query yourself, the moment of firing the query is more or less a thing you decide.

Hope this helps.

also a relation on a global is cached by servoy so it could be that it that for the same global it wont do another query.

That is what i was looking for !

Thanks Johan.