Double relation

Hi, all

I’m sure it must be somewhere already but I can’t find it… so here it goes:

I need to fetch an info that’s two table away through relation from my starting table.

Ex.:

orders <----> customers <----> sales_rep

these are my three table, they are linked through relation like this:

—order----- ------customers------- —sales_rep—
customer_id <-----> customer_id , rep_id <-----> rep_id

So, in my order form, I want to display the rep. name… very simple, I come from filemaker, it’s easy to do back there, I’m sure it is also in servoy, but I’ve no clue how…

Thank you all

I use different ways to do this :

  1. an unstored calculation

return ..<field_name>

  1. a valuelist

place a field on the form for with order_id as dataprovider and then specify both relations
in the valuelist. Then chose the appropiate field to display.

  1. fetch the value in a method by using

var _rep = ..<field_name>

Regards,

Thank you very much for your answer. I guess that i’ll use that for now, but I was hoping for a more direct approach just like in filemaker where you simply choose the fields two relations away and it does the redirection for you… I don’t like to add variables to do servoy jobs, it becomes cluttered very quickly.

Philippe Beaulieu
Progi-Media inc.

Hi Philippe,

If you only want to show the data then you use a label and use the ‘merge code’ approach. No calcs required here.
Just put a label on your form, edit the text property and use the %%relation1.relation2.fieldname%% format.
Also make sure the displayTag property is enabled.

Hope this helps.