collect_if() operator

Tinderbox Icon

A v4.0.0 function collect_if() builds sets. (See collect() for a related new operator.

collect_if(where,condition,attribute)

builds a set by collecting all the notes corresponding to where, testing each note to see if it meets condition, and adding the value of the designated attribute to the set.

where may be any of {child,descendent,sibling,ancestor,all}. In addition, where may be argument that designates a particular (single) note other than this.

condition is a valid conditional test - i.e. it equates to true when matched.

what can be any expression, but is typically an attribute.

For example,

collect_if(child,$Status="Important",$Name)

will construct a set of the names of all of this note's important children.

Note that collect_if's function is related to agents; many tasks you might perform with collect_if could be done as well, or better, with an agent.


Up: Set creation operators
Previous: collect() operator  Next: links() operator 

[Last updated: 3 Dec 2008]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox