Tinderbox 7 Icon

Basic action code syntax

Case sensitivity: Action code operators are always case-sensitive (unlike export codes).

Delimiters. Each discrete code expression (explained further below), must be terminated with a semi-colon. This acts like a full stop (or period) in normal text writing. Tinderbox, will run the first expression - up to the first-semi-colon - before moving on the the next and so on. Queries, as used by agents, do use action code operators but use slightly different syntax and never use a delimiter.

In action code, the delimiter can be omitted in two cases.

Firstly, the action only contains one expression. Both these are valid code for the same action:

$Color="red" 

$Color="red"; 

Secondly, it is the last expression in a multi-expression action.Both these are valid code for the same action:

$Color="red";$Color2="blue";$StartDate=date("now") 

$Color="red";$Color2="blue";$StartDate=date("now"); 

Note, in this second context, how all expression except the last one must have a semi-colon delimiter.

Where a multi-expression code includes if() conditional sections, a delimiter must be placed after the closing '}' if another expression follows after. For instance:

if($Prototype=="Event"){$StartDate==date("today)} 

But:

if($Prototype=="Event"){$StartDate==date("today)};$Color=="red" 

Note that the code inside the curly brackets doesn't need a delimiter as there is only one action. But, a further action follows the if() test so a delimiter is needed after the '}' that closes the if() action. Where there is an else branch, e.g. if(){}else{}, the delimiter goes after the '}' at the end of the else branch. code inside the {} sections obeys the rules above and only needs delimiters between multiple actions.

However, if in doubt, use a delimiter after each action!

Expressions: 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; 

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.

Coding conventions in Tinderbox. See more.

Review old code: Longtime users of Tinderbox should revisit code to ensure all string literals are quoted as current support for non-quoted string usage is for legacy purposes and will be withdrawn; by convention paths and designators are not quoted but there is no harm if they are and quoting all strings may be an easier approach for new users to take. Likewise, new users trying old code samples should be aware that the code may use legacy syntax.



A Tinderbox Reference File : Actions & Rules : Basic action code syntax