I have a problem and wonder if anyone has a smart idea:
How can I efficiently verify a given relationship name?
I have a String containing the name of a Servoy relationship and like to find out if that exists. Does anyone have a bright idea on how to do is without accessing every form in a loop?
I tried to do a query in the repository, but it is a little difficult to figure out which solutions/modules are currently loaded and therefore have to be queried. Maybe there is a relation in the repository, but that sits in a solution that is not loaded…
But that needs a starting point like a record or a form. You can’t just fire a databaseManager.hasRecords(relation) into the sky, can you? I think it will always return false, if you just do that let’s say in a global method. But keep on puzzling
that also requires that the relation is reachable from where you are (form/record). It does not work for example if you just have the name of the relationship, no idea what the left and right side tables are and want to test if the relationship exists at all inside the solution.
pbakker:
mmm, if you do not know the form/table on the left side of the relation, then testing for it will become a bit difficult, I think
Paul
Hello Paul,
I know the table on the left side, but I am not sure that I can get a form (maybe a form for that table doesn’t even exist). Do you have an idea what can be done if you know the table?
If you know the form, then I know what to do, but i think you know that yourself as well
If you know the table, you could loop though the forms, get their table, compare yadayadayada…
But, if, as you say, ther emight not even be a form based on this table, it’s getting to the point where I do not think it’s possible to evaluate the validness of the relationName stirng.
For my search. Currently I have to use Servoy relations for searching since I can’t use joins (you remember that discussion on Joins and loadRecords). If I want to use related data, I need relations. The names of those relations are needed to be able to search. Since some of the modules in my solution are built by my customer themselves, they need to enter their table/relation info as well. For stability reasons it would be need to be able to find out if the relation name that they punch in is valid (at least that it exists).
There is a solution for your “Joins and loadRecords”, there is currently no way to verify if a relation name is valid…but how whould you use such a relation name in your search?
Jan Blok:
There is a solution for your “Joins and loadRecords”
You mean the google style? I am thinking about how my interface would look like. I am still brainstorming about this…
but how whould you use such a relation name in your search?
I am doing that now. The user tells me what is the main search table (what he wants to find). I have all tables in one of my tables. I also have a table containing all relevant relations. So I know all tables that can be “seen” from the “main search table” and offer those a search criteria.
In the search method I do something like (out of my head)