This version is out of date, covering development from v4.6.0 to v4.7.1. It is maintained here only for inbound reference links from elsewhere. Jump to the current version of aTbRef. |
|
A Tinderbox Reference File : Objects & Concepts : Basic Comparison Operators : Equals | aTbRef Site Map |
Equals |
$Attribute == $OtherAttribute
The double-equals (==) usage for tests of equality replace older use of a single equals sign.
Code in older TBXs may require updating as a single equals sign used as an equality test may now get interpreted as an assignment of the right side value.
Note that, when parsing queries, the template is evaluated in the agent's context. In particular, attribute references on the right side of the test are made to the agent and this refers to the agent. Conversely, in actions, on the other hand, the action is evaluated in the context of the note to which it is applied.
$BooleanAttribute == true
Matches notes whose BooleanAttribute value is true.
For other data types, testing for the presence of a value can be considered a boolean test. This is useful as queries and if() clauses use a 'condition' which must resolve as true or false.
$DateAttribute == "aDate"
$DateAttribute == date(aDate)
$DateAttributeA == $DateAttributeB
True where $DateAttribute date matches the given aDate's calendar day.
$DateAttribute == "today". True where $DateAttribute date is today's date (same calendar day).
$DateAttribute == "yesterday". True where $DateAttribute date is yesterday's calendar day.
$DateAttribute == "tomorrow". True where $DateAttribute date is tomorrow's calendar day.
$DateAttribute == "never". No date: earlier or later than any real date. When agents search for a specified time range, the comparison operators < and >treat the special value 'never' specially. Previously to v2.4, < or > comparisons to 'never' were true if no DateAttribute was specified. Now, 'never' is not < any date, nor is it > than any date, but it is equal to 'never'.
Modifiying placeholders. Use of date placeholders may be further modified:
From v4.6.2 these:
$DateAttributeA >= $DateAttributeB
$DateAttributeA <= $DateAttributeB
also return true if the dates are on the same calendar day.
$NumberAttribute == number
True where NumberAttribute value equals the given number. Note the number value is not quoted.
$StringAttribute == "data"
True where StringAttribute value is identical to the data string. For instance:
$Text == "Hello"
...would be true if the note's text consisted only of the word "Hello".
Note the data string is must be quoted (it may work without quotes but don't rely on that!).
Tinderbox does not perform equality comparisons on Color-type and Set-type attributes.
Up: Basic Comparison Operators | |
Next: Does Not Equal |
Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]