Tinderbox 8 Icon

Expressions in Action code

Expression is a term for action code involving some evaluation, and by extension any discrete complete section of action code. Thus even the simplest code, such as the assignment of a literal value, may still be regarded as an expression:

$Text="A Life on the Ocean Wave."; 

More often, actions and rules may use simple arithmetic and logical expressions.

$Width=5+2; 

$Width=$Height(parent)*1.5; 

$Urgent= ($Overdue|$Essential); 

$Width =($Width(/$Configuration)+1)*$Scale; 

Note the latter examples above the right-side involves more complex evaluation where extra parentheses are added to make explicit the evaluation order, as discussed further here.

Because Tinderbox recognises operators such as + and -, notes whose names begin with characters other than letters and numbers may sometimes be interpreted in unexpected ways. For example, if a note is named "6*7", rules like

$Prototype=6*7 

…might be parsed as a multiplication with the result of 42.

$Prototype="6*7" 

…should have the expected effect. Quoting characters will always cause Tinderbox to treat such content as literal text.

Actions and rules may use computation with data attributes, including attribute values from other notes. For example:

$DueDate=$DueDate(parent)+"7 days"; 

$DueDate=$ExpiryDate(parent)-"10 days"; 

Date attribute values can also be computed with literal dates and date designators:

$DueDate ="November 15, 2004"+"7 weeks" 

In the previous examples note that the actual and partial date strings use quotes.



A Tinderbox Reference File : Actions & Rules : Expressions in Action code