Code Type:
Code Scope of Action:
Code First Added:
Code Altered:
^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.