Hello,
I just want to share an idea, that in my eyes would solve quite a few problems fairly easy.
- OR-Relation
Quite a few requests have come about OR-Relations or enhanced possibilities in relations. Some Servoyan answered that this was difficult because of brackets and so forth. I think something neat would be this:
In the “Define Relation” you can still choose Source and Destination server and table, define the relationship name and where is now the definition of keys you have a tab panel. One tab says “Match keys”, the other says “SQL”. Under “Match keys” we have what is there today. In the “SQL” tab we can enter any SQL statement (the WHERE-clause, at least) including global variables. Something like
(field_a = globals.filter_left or field_b <= globals.filter_right) and field.c IS NULL
could be entered. This way we could do flexible joins and would have to take care about the outcome ourselves. Under “Options” I would suggest to disable “Allow creation of related records” in SQL mode. “Delete related records” - I am not so sure, either.
- addFoundSetFilterParam
should be changed to a form property called “SQL filter” right underneath the useSeperateFoundSet checkbox. It behaves just like the text property, a dialog opens where we can enter SQL. If we enter a WHERE-clause there, Servoy will use that whenever it querys data, also when used over relations or in searches, just like a foundSetFilter.
I believe that both suggestions would greatly enhance “foundset management”. Both shouldn’t be so hard to do, is it ? I understand the concept of Servoy to keep the user away from SQL. Servoy does a great job in handling the basic jobs, even allowing for pretty sophisticated stuff.
On the other hand we are not given the obvious possibility of entering pure SQL anywhere (except for databaseManager functionality, I have to admit), even tracing it is not so easy. And sometimes it seems even easier to type a SQL statement instead of learning the “Servoy way” when using for example addFoundSetFilterParam(). The other day I came about something that I still haven’t solved: I want to use a foundSetFilter to filter for one column to contain 1 or the other column to contain the user ID. With SQL I could easily do that.
I believe that the consistency of a solution doesn’t even have to suffer from this, either. It should be possible to test an SQL Statement for validity and return an error if the statement is wrong.
Is there any other ideas on this?
Thanks for taking the time
Patrick