Tinderbox v9 Icon

= (i.e. value assignment)

Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Operator  [other Operator type actions]

 Item  [operators of similar scope]

 Assignment  [other Assignment operators]


 As at baseline

= (i.e. value assignment)

A single = symbol is used only as a method of assignment (for tests of equivalence, use a double equals sign e.g. == ):

$AttributeA = $AttributeB; (attribute value

$AttributeA = data; (literal data)

$AttributeA = 4 * ($Price / 2); (expression)

The assignment is always from right to left; the left-side attribute takes the value of the right side attribute/expression. It is more usual for the right side to be evaluated (an expression) than the left, though the latter can occur.

Thus assignment sets the value of the specified left-side attribute the given right-side evaluated result; most often this is simply an attribute value. Where the right-side value is an attribute name, the $-prefix must be used. Take a note that has a $Color value of "red" and the $Rule:

$MyUserColor = "Color"; 

The result is not the text value red but rather it is a text value "Color". Most likely there is no defined named colour named "Color" so some some other colour value, not the intended one, stored in $MyUserColor. If you want the value of an attribute, i.e. the $Color value of 'red' in this example, then your $Rule should be:

$MyUserColor = $Color; 

You must use the $-prefix: see further detail below.

Actions and rules are allowed to specify a different referenced note, just as they can with a source attribute reference:





In the last case the secondary attribute will hold a note name or path. Complex use of left-side expressions is allowed.

Do not mix $Attribute and Attribute(regex) syntax in a single call, i.e. $Attribute(regex), as this will cause expected results. Use one syntax or the other. This possible conflict should only ever occur in the context of queries or operations that allow query-style code.

If a value only needs to be assigned once, consider using a logical OR join.

Using Paths (offset references)

$AttributeA = $AttributeB( note/item/path )

This sets the value of the $AttributeA to that of the $AttributeB of the same note (i.e. this or current), if no argument is specified, or of a note specified through name, item or path. (See more on paths). From v4.6, paths may also be used on the left side of the overall expression:

$AttributeA( note/item/path ) = $AttributeB

$AttributeA( note/item/path ) = $AttributeB( note/item/path )

Using query back-references

NOTE: the following syntax can only be used in the context of a query. In a query (an agent's query or an if() condition in an action) it is possible to combine a regex query with an action that uses the value of the found regex:

query: $Text.contains("email: <(.+)>")

action: $TheAddress=$1;

…will set TheAddress attribute value to the regex found in text. It is assumed that back-references $1-$9 may be used, assuming the regex generates more than one such references.