Tinderbox v9 Icon

contains(item)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

Operator Uses Regular Expressions: 

Operator Has Newer Dot-Operator Variant: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Query Boolean  [other Query Boolean operators]

 Baseline

 As at baseline

 [More on regular expressions in Tinderbox]

Yes


contains(item)

Returns Boolean true if the note evaluated from a single item is a direct child of the current note or, put conversely, if the note is the parent of item. Thus it can be thought of as an "is parent of" operator and, as such, a counterpart to the "is a child of" operator inside().

The item argument must be quoted unless an attribute reference. Ways to define item.

Examples:

contains("/foo") 

This is a full path so can match only the root-level note 'foo'. But:

contains("bar") 

could match any note with the name 'bar' of which there may be more than one. If there is more that one, Tinderbox chooses one. This is fine if one match was desired but if there are known to be multiple 'bar' notes and it is desired to locate parent container of every one, then a different approach is needed, using any(): the process is described under any().

NOTE: Checking attribute values, as opposed to object containment

There are a range of other tools to check if a String-, List- or Set-type attribute's value contains a desired search string/regex.

Legacy issues

This operator replaces the legacy #contains query operator. The latter should not be used for new code.