Tinderbox v10 Icon

$AttributeName[(scope)]


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Data Type Returned: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

Operator Uses Scoped Arguments: 

 Property  [other Property type actions]

 Item  [operators of similar scope]

 Assignment  [other Assignment operators]

 source context dependent

 v4.6.0

 Baseline

 As at baseline

 [More on scoped arguments in Action Code]


$AttributeName

In action code contexts, an attribute's name prefixed with a $-character implies a reference to that attribute, thus a placeholder for that attribute's value. In a coding context is acts as a variable name where the variable name must be that of an existing attribute and the variable's value is got from or set to that attribute.

A reference on the right side of an expression fetches the attribute's value. A reference on the left side of an expression has its value set to the result of the right side. The following example combines these uses whereby in the current object (a note, agent, adornment, etc.), the user attribute $MyNumber is being set to the value of system attribute $ChildCount:

$MyNumber = $ChildCount; 

In queries and conditional expressions, and attribute reference implies a shortened Boolean test.

The test can be turned in a negative (i.e. that no value is set) by using a '!' prefix: see !$AttributeName, occasionally if the !-prefix does not work, try enclosing the expression in parentheses (!$AttributeName) to help signal intent to Tinderbox's action code parser.

$AttributeName(scope)

Besides the basic form above, which is essentially $AttributeName(this), an offset address can also be made to the value of an attribute in another object— i.e. other than the one in current focus, by using an extended syntax where the scope argument (defining scope) to refer to one or more note(s).

Importantly, here the scope argument is not evaluated for expressions unlike in some action code operators. This means that here, scope cannot be a complex code expression. However, where that need arises eval() may offer a workaround or consider using a user attribute to hold the output of the expression and then use that attribute's value (i.e. in the manner of bullet #4 above).

The extended syntax form may be used on the left or right side of an action code expression. In other words, you can use this syntax to fetch (right side) or set (left side) an attribute value from some other object. Generally, offset addresses are used on the right side to fetch data from another object.

Examples, right side:

$MyString = $MyString("Some other note"); 

$MyNumber = $MyNumber("A root container/Some Container/Some other note"); 

$MyString = $MyString(agent); (this designator only works in agents)

$MyString = $MyString(adornment); (this designator only works in adornments)

$MyList = $MyString("Some other note;Another note;Different note"); 

Examples, left-side:

$MyString("Another note") = $MyString("A note"); 

$MyDate(parent) = $MyDate; 

In fact, an offset can even be used on both sides of the expression. For instance, the rule in a note "Some note" might use the following code to refer to attributes in two other notes:

$MyColor("A note") = $MyColor("Another note"); 


See also—notes linking to here: