This version is out of date, covering development from v5.0.0 to v5.12.2. It is maintained here only for inbound reference links from elsewhere.

Jump to the current version of aTbRef.

Tinderbox Icon

Attribute value pattern matching (DEPRECATED)

This pages describes features, codes or syntax whose use is now DEPRECATED, i.e. not advised either for new or continued pre-existing use.

Deprecated aspects of Tinderbox may be supported on a legacy basis but the latter support can't be presumed to be indefinite. Therefore you should update your active TBX documents to latest practice as soon as practical.

For all methods listed here use the .contains() function (and sibling functions) instead.

Attribute values may be used as a target for queries:

Whilst most easily understood in the context of string data, the target attribute need not always be specifically of String type. For instance, a File type attribute holds a path to a file - which is a string - and can thus be queries in the above fashion. Set-type and List-type attributes are collections of strings so can be pattern-matched, though only for whole value strings and not parts of individual value strings.

Note text can be searched too, as the Text attribute represents the note's body text.

IMPORTANT! Note that in this type of query, although an attribute name is used, a $ prefix is not used.

This is also a shorter AttributeName query method with not pattern supplied that gathers notes for which the boolean value of AttributeName (of any date type [sic]) evaluates to true. For numeric attributes, true is any value other than zero. For string attributes, true is any value other than "false" and the empty string. For date attributes, true is assumed to be a matching day. This query type may also be used in export templates. For example: ^any(children,Urgent)^ gathers all notes which have at least one child whose Urgent attribute resolves to true.

StringAttribute( data or pattern )

Gathers all notes whose StringAttribute contains the data string or matches the pattern regular expression.

For a negative match, where the string is not matched, use an alternate syntax with a preceding exclamation mark (!):

!StringAttribute( data or pattern )

Note how the '!' that triggers the match reversal is placed before the attribute name and not the (data or pattern) part. Thus, opposing examples:



The above two example would have no overlap in their matches. N.B. the $ prefix is not used before the attribute name.

SetAttribute( data or pattern )

Gathers all notes whose SetAttribute values match the data string or matches the pattern regular expression. Unlike a string attribute value where partial matches can be made, the match here must be for a complete individual set value.

Thus for an Set called MySet with three values 'Carpet;Carrot;Car;', a query for $MySet(Ca) would return no matches. This is because the string 'Ca' is not a complete match for any of the values. MySet(Car) would get 1 match only - 'Car'. Despite both other values containing the sub-string 'Car', there is no match.

Otherwise the observations above re patterns and negative searches apply.

Possible relevant notes (via "Similar Notes" feature):

A Tinderbox Reference File : Agent Queries : Attribute value pattern matching (DEPRECATED)