This version is out of date, covering development from v8.0.0 to v8.x.x. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v8 Icon

^if( condition )^


Code Type: 

Code Scope of Action: 

Code First Added: 

Code Altered: 

 Conditional Mark-up   [other codes of this type]

 n/a   [codes with similar scope]

 Baseline

 format"


^if( condition )^

Test if the condition is true, then includes everything from the ^if statement to the ^else^ or the ^endif^. If the else/endif mark-up is omitted the text following the closing ) bracket of the condition is returned.

Unlike in very early versions of the app (and thus old examples, the condition statement is a query written in action code (essentially the same syntax as if writing an if() action test. For example,

^if($Name.contains("tbx"))^ 

…is true if the note's title contains the string "tbx",

^if(!$Name.contains("tbx"))^ 

…is true if the note's title does not contain the string "tbx", and

^if($Width>5)^ 

…is true if the note's width exceeds 5.0

For the first two examples above the value matched can be an actual string or a regular expression.

In the ^if^ condition, the query is always evaluated in the context of this note.