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 other that queries and conditional expressions, 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.
$AttributeName(path)
Besides this basic form above, an offset reference can also be made to the value of an attribute in an object other than the one in current focus, by using an extended syntax where the path parameter is one of:
- A note title ($Name). N.B. this is probably the most common offset usage.
- A full path ($Path). This form may be necessary if the title alone is not unique (or clashes with a designator name).
- An item-scope designator.
- An attribute, or an offset attribute reference, holding one of the above.
- A note or aliases ID number ($ID), though this should be used with caution. Ideally use one of the other forms above.
The path argument is not evaluated for expressions. Thus 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.
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");