Queries are used by:
- action code conditional statements
- action find() operators (most normally for scoping arguments)
Queries are written in action code syntax but with some differences:
- Queries never use semi-colon terminators unlike in rules, etc.
- Equality tests (are two things the same?) always use a == operator (two equals signs).
- Note: very old code examples may use a single '=' and if using copy paste do not forget to double the = to ==.
- If a query has multiple parts, these are joined using & (and) or | (or) join characters.
If it is desired to control the order in which different parts of a multi-term query are evaluated, each query term—or sub-groups of query—can be enclosed in parentheses, i.e. round brackets '(' and ')'. As with parentheses in a spreadsheet formula, Tinderbox will evaluate the inner-most (most deeply nested) parentheses before working outwards until the whole query is evaluated.
Action code offset addresses can be used, i.e. referencing values in another note
$Color("Some other note"). In the special case of wanting to reference attribute values in the agent itself, use the 'agent' designator to refer to the attributes of the current agent, whilst smart adornments can similarly use the 'adornment' designator. For example:
This agent gathers all "Important" notes and sets their colour to match the colour of the agent. Note that this is different from
since "this" refers to the note being gathered, and is also different from
since "parent" is the parent of the original note, not the parent of the newly-made alias. The latter is a case where, for intrinsic attributes, it may be necessary to use the 'original' designator to avoid using the aliases value for the attribute. Thus:
More on Queries