Relationship name in variable

var foo = my_relationship_name;

forms[form_name].foo.loadAllRecords();

Doesn’t seem to work? I am sure the answer is somewhere on this forum, but I can’t seem to find it. I am assuming there is a preferred way to reference the relationship.

Thanks in advance :oops:

try this:

var foo = 'my_relationship_name' 

forms[form_name].foo.loadAllRecords();

or this:

var foo = my_relationship_name;

forms[form_name][foo].loadAllRecords();

How about

var foo = 'my_rel_name';
forms[form_name][foo].loadAllRecords()

I am not quite sure thought what you want to achieve by loading all related records over a form…

Hi Jef,

jbader:

var foo = my_relationship_name;

forms[form_name].foo.loadAllRecords();

In your code foo doesn’t hold the relationship but the foundset of that relation.
So if you want to use a relationship in a variable then you need the following syntax:

var foo = "my_relationship_name";

forms[form_name][foo].loadAllRecords();

Hope this helps.

And of course Harjo and Patrick were faster than me :(

:)

ofcourse! :lol:

Thanks all :D

Support is not bad here. 3 answers in 3 minutes. :lol:

Not only 3 answers in 3 minutes but 3 the same answers, so it must be right ;)