Create set attribute from a child list


(Kay Krämer) #1

Hi…

I would like to use a key attribute from the “set” type, and the set should be a list of persons, who are the children of a container, so that I can select the persons, who live in the container, in my key attribute. I don’t know, how to express my wish properly, sorry…
So here is also a screenshot, perhaps somebody knows, what I mean.

How can I do this?

Kind regards, Kay


(Paul Walters) #2

Here is one approach, using this $Rule in the notes’ prototype:

$MySet=collect(siblings,$Name).sort($Name);

Collect Example.tbx (58.2 KB)

collect() is the way to go – whether in a rule or an agent or an edict, depending on the size of the document / processing load.


(Kay Krämer) #3

Ok… goes in a good direction :smile:

But now I need the siblings of /Personen/Externe, so I have to use the “inside” command somehow…?


(Paul Walters) #4

Yes, you are on the right track.

Collect Example_2.tbx (60.9 KB)

This example is only for illustration. I’m sure someone else has far better ideas than me.


(Kay Krämer) #5

OK… thanks a lot.

I now use $weitergeleitet=collect(find(inside(/Personen/Externe)),$Name).sort($Name);

as a rule in a note, which is not the prototype. As this note has no other function, I called it simply “ghost”. Now when I enter the first letter of a person, which is in my person list, it appears in my set variable. Perhaps a bit complicated, but if I want it simple, I must not use TB :laughing: