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

= (assignment)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Operator   [other Operator type actions]

 Item   [operators of similar scope]

 Assignment   [other Assignment operators]

 Already in v5.0.0

 5.6.0


«In post v4.6 syntax, a single = symbol is used only as a method of assignment:

$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 color 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 target note, just as they can with a source attribute reference:

$AttribName(parent)="theValue" 

$AttribName(/path/to/note)="theValue"

$AttribName(/path/to/note)=$MyValue(parent) 

$AttribName($AnotherAttribute)="theValue" 

In the last case the secondary attribute will hold a note name or path. From v5.6.0, more complex use of left-side expressions is allowed.

Do not mix $Attribute and Attribute(pattern) syntax in a single call, i.e. $Attribute(pattern), 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 pattern query with an action that uses the value of the found pattern:

query: Text(email: <(.+)>)

action: $TheAddress=$1

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


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


A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Scope : Item-based operators : = (assignment)