Rookie question on relations in Servoy

Hi,

I’ve been trying to wrap my head around how Servoy prefers to see relations between tables in a database. So, let’s say I have a database with tables related as so…

Tenant → Woodworker → Projects → Sub-Projects → Images.

Each table has a one to many relationship with the table below it. Let’s say that at each table, I have foreign keys embedded for each “layer” above it. So, Tenant would have Tenant_id as its pkey, Woodworker would have Woodworker_id as pkey and Tenant_id as fkey, and so on. Is there a “best way” to set up the relationships in Servoy, or do you just set up the relationships you need, or what? For example, if I set up a “master relationship” in Servoy, so, one relation with all of the keys in it all the way down to Images, is that sufficient for Servoy to navigate around the database? Or, is it better to set up an individual relationship at each level, so, have relations like…
Tenant to Woodworker
Tenant to Projects
Tenant to Sub-Projects
Tenant to Images
Or, as I said above, is it more a matter of just creating the relationships you need when you need them?

At this point, I’m a bit unclear on the concepts. I watched the Flash tutorial, but since it used a specific example, it didn’t quite answer my question.

Any advice would be appreciated.

Thanks and have a good day.

Ron

Hi Ron,

the question about relations is what kind of result you will get.
I don’t think that a “master relation” with all the pk’s you would need is best practice and returns always correct results. In my opinion it would be better to create a relation for the function(s) you would like to get spezific results. Furthermore keep performance in mind.

Regards
Thomas

Hi Thomas,

Thanks for that information. Makes sense.

What I’m doing right now is creating relations for those tables that are just tied to the tenant table directly, basically tables that are used for lookups and the like. Those are pretty obvious in order to keep those segregated from other tenants. For the “main” tables, I’ll just wait until I’m creating the forms and such, and build the relations I need to, as you say, get the results I want.

Thanks again.

Ron