Else and Else-If

Within a Conditional Section it is possible to include an Else statement to allow alternative content to be provided in case where an expression is false.

Else-If style statements provide an alternative expression to be evaluated to conditionally include other content.

Else statements

These may be used once within a <<cs_ conditional section and provide an alternative option if the condition is not true.

<<cs_trees>>option 1<<else>>option 2<<es_>> is like saying:

IF trees= "true" THEN

display all text from <<cs_trees>> up to <<else>>

OTHERWISE

display all text from <<else>> up to <<es_>>

The data would have: "trees":"true" to display option 1, and "trees":"false", or simply omit "trees", to display option 2 (JSON example).

Else-If statements

An Else statement may also contain an expression making it an Else-If statement.

This allows an alternative condition to be tested if the first condition is not true.

If neither the <<cs_ expression nor the <<else_ expression is true, no output will appear for this section in the final document.

Combining Else-If and Else statements

In the example template, the expression {instruments>8} will be evaluated.

If "true" then all following text up to the next <<else_ will appear in the final document.

Otherwise, the expression {instruments>3} will be evaluated.

If this expression is "true" then all the following text up to the next <<else will appear.

If both expressions evaluate to "false" then the text from <<else to <<es_ will appear.

The data would have: "instruments":"2" (JSON example).

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input