Tinderbox v9 Icon

$AttributeName (reference to source item)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Property   [other Property type actions]

 Item   [operators of similar scope]

 Assignment   [other Assignment operators]

 Baseline

 


$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(path)

Besides the basic form above, an offset reference 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 path parameter is one of:

Importantly, the path argument is not evaluated for expressions unlike in some action code operators. This means that here, path cannot be a complex code expression that generates a value equivalent to one of the above. 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 references 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)

Examples, left-side:

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

$MyDate(parent) = $MyDate; 

In fact an offset can even on be used 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"); 



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : $AttributeName (reference to source item)