Using relations from array

Hi,

i want to retreive the value of a column trough several relations : forms[form][rel1][rel2][rel3][column]

the relations are in an array (relArray) and there can be 1 to 3 relations.

i can do this by checking on the array length :

if (relArray.length==1)
val = forms[form][relArray[0]][column]
else if (relArray.length==2)
val = forms[form][relArray[0]][relArray[1]][column]
else if (relArray.length==3)
val = forms[form] [relArray[0]][relArray[1]][relArray[2]][column]

But i do not like this way of programming. is there a way to use the array directly in the line : val = forms[form]…array.function…[column]

i tried joining the array with a . , but then servoy sees the string “rel1.rel2.rel3” as one relation and not as three relations.

Regards,

i think that relation1.relation2 should work

what happens if you try that on a record:

var record = foundset.getRecord(0)
var rel2 = record.relation1.relation2;

then rel2 should be the second related foundset

Thanks Johan,

That did the trick !!

Regards,