This version is out of date, covering development from v5.0.0 to v5.12.2. It is maintained here only for inbound reference links from elsewhere.

Jump to the current version of aTbRef.

Tinderbox Icon

Conditional Actions (if clauses)

This note has been updated and moved to the action code operator list - see if().

The remainder of this note refers to deprecated usage.


Although, for long-term users with old files, there is legacy support for conditional export code ^if syntax^ it is strongly deprecated in actions and rules.

Note the slight difference between the two two conditional syntaxes. The export code ^if version evaluates a conditional test for a resolved value of true. The action code if version evaluates an action code expression also tested for a resolved value of true. While both ultimately test for a true result, the initial test may need to be written slightly differently for each version.

Note that in the action code conditional syntax the $Attribute=value assignation is made inside the {} brackets. Conversely, the older ^if syntax requires the a single left hand Attribute= with the alternate values embedded in the if statement at right side. Thus, new:

if(conditional expression){$Attribute="value1"}else{$Attribute="value2"} 

…versus old (now deprecated):

$Attribute=^if(condition)^value1^else^value2^endIf^ 

The new syntax makes testing for negatives much easier than using ^not, as an attribute name may simply be prefixed is an exclamation mark:

if(!$MyString){…etc. 

Both the above work but using a $ prefix for attribute names is perhaps better for long-term maintenance as the syntax is explicit.


Possible relevant notes (via "Similar Notes" feature):


A Tinderbox Reference File : Actions & Rules : Conditional Actions (if clauses)