Operator Scope of Action:
Operator First Added:
If the collected attribute type is multi-value, i.e. Set or a List type, collect() adds its elements to the result. If the collected attribute is not a Set or List type attribute, but contains a semicolon, quotation mark, or parentheses, the value will be added to the result as a quoted string. The change should correct a variety of confusing edge cases.
attribute can be any expression, but is typically an attribute.
$MyList = collect(children,$Name);
constructs a set with the name of each child of the note.
$MyList = collect(children(/agents/books),$Name);
does the same for children of the note 'books' inside 'agents'.
$MyList = collect(children,$Width * $Height);
collects a series of numerical values of each child's map icon height/width in Tinderbox map units. Thus if a child had a $Width of 4 and $Height of 2, the collect() result for that item would be 8.
If a list of unique values is required, i.e. a set rather than a list, simply pass the output to a Set attribute. Thus if:
$MyList = collect(children,$FavFruit); $MyList is "Apples;Oranges;Pears;Apples"
$MySet = collect(children,$FavFruit); $MySet is "Apples;Oranges;Pears;"