Equals

Tinderbox Icon


$Attribute == $OtherAttribute

The double-equals (==) usage for tests of equality replace older use of a single equals sign.

Previously, a single equals sign acted as either an assignment of the right side to the left or as an equality operator, Tinderbox deciding which form to use depending on context. From v4.6 onwards, although a single equals sign may be used for an equality test the usage is deprecated and such legacy syntax support may be withdrawn in subsequent versions.


$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.


$ColorAttribute == "data"

The data needs to be a string that matches $ColorAttribute case-sensitively. The the color set in the attribute is "#CC3F63", date of "#CC3F63" will yield true, but data of "#CC3F63" will yield false; the "#" prefix character must be included for non-name colours.

Note that Tinderbox's pre-defined named colours are all-lowercase, and that hexadecimal colour codes created via the color picker use lower case for any letter characters.


$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:

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.


$ListAttribute == "data"

Note: Tinderbox does not perform meaningful equality comparisons on List-type attributes.

A match only occurs if data matches all values in the list. Thus if the list value is "dog;cat" and the data string is "dog", the result is false. If the string is "dog:cat" the result is true; a successful match also occurs for "cat;dog".

It can be seen that data is parsed for all values but that a true result is only achieved if all values match, whereas the likely intention of the user is to see if data matches one, or more, list values.

Lists are best compared using the List.contains("pattern") action operator.


$SetAttribute == "data"

Note: Tinderbox does not perform meaningful equality comparisons on Set-type attributes.

A match only occurs if data matches all values in the set. Thus if the set value is "dog;cat" and the data string is "dog", the result is false. If the string is "dog:cat" the result is true; a successful match also occurs for "cat;dog".

It can be seen that data is parsed for all values but that a true result is only achieved if all values match, whereas the likely intention of the user is to see if data matches one, or more, set values.

Sets are best compared using the Set.contains("pattern") action operator.


$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!).


Up: Basic Comparison Operators
  Next: Does Not Equal 

A Tinderbox Reference File : Objects & Concepts : Basic Comparison Operators : Equals aTbRef Site Map


[Last updated: 6 Feb 2012, using v5.10.1]

Google search aTbRef for:  

Creative Commons Licence

aTbRef by Mark Anderson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
[See aTbRef CC licence Attribution & Waiver info]

Made with Tinderbox