Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator Last Altered:
Operator Uses Scoped Arguments:
Function [other Function type actions]
Query [operators of similar scope]
Dictionary, Set & List operations [other Dictionary, Set & List operations operators]
Baseline
As at baseline
find(query)
The find() operator returns List-type data of the $Path of all items matching the query argument scope (defining scope). Note that find(), unlike agent queries, does not de-duplicate its matches so any aliases in scope with be matched: to avoid the latter see section 'Filtering out aliases' below.
To return a list of paths for notes with prototype of 'pRef' and fro which boolean $HasRef is false
use:
find($Prototype=="pRef"&$HasRef==false)
Conceptually find() is intended for where no item or group designator exists for use inline in action code (note: such designators were the only scoping terms in early version of Tinderbox). In most cases an agent is the likely and better alternative, noting that agents can also use the results of other agents. find() can also be thought of as a short way of writing:
$MyList = collect_if(all, expression, $Path);
where the expression is scope.
The find() operator omits notes for which $Searchable is false
.
Filtering out aliases
The find() operator does not de-dupe results in the way an agent does. As find() collects $Path data, aliases both inside and outside agents may also match the query. Adding !$IsAlias
as a query term will scrub any aliases from matching a search.
Thus if getting unexpected results via find(), consider whether it is because some de-duping was (incorrectly) assumed and be prepared to sharpen the query terms accordingly.
In the above example, to additionally filter out possible alias matches add an extra query term:
find($Prototype=="pRef"&$HasRef==false&$IsAlias==false)