Conditional Paragraphs
You can make the appearance of certain paragraphs (or even whole pages) dependent on the user’s answer to a question. To do this using the no-code Word add-in:
- Open the Word add-in and select the workflow you'd like to use.
- Highlight the phrase you'd like to make conditional.
- Click "Show paragraph when..."
- Choose the variable and value you want to base your logic on.
- To add complex logic, click "Add Condition" and repeat step 4.
- Click "Insert.
If you have a conditional paragraph (as opposed to a conditional word or sentence within a permanent paragraph), your if/endif statements will include a %p as shown below, so that the system knows to remove the entire paragraph and spaces before and after it.
Standard Conditional Paragraph Syntax
{%p if VariableName %}
Conditional paragraph here.
{%p endif %}
Conditional Numbered Paragraphs or Table Rows
This formatting can be used with numbered paragraphs or tables, too, by entering your “if” and “endif” phrases on separate lines before and after the numbered paragraph (or the desired table row), like this:
- {%p if VariableName %}
- Paragraph text here.
- {%p endif %}
Everything above stays constant except the variable name if your question is a Yes/No. For multiple choice/checkbox questions, you will use the X =='Y' and variable['choice'] syntax shown in the preceding Conditional Phrases section.
Using "Else" Statements
The best way to set up alternate conditional statements is using the Word add-in, where you will set separate conditions (each with its own if and endif for each condition). However, you are also able to use else statements to make the conditions shorter by placing {% else %} in between two statements.
For example, a statement like this:
{% if variable == 'Option 1' %}Text here.{% endif %}{% if variable == 'Option 2' %}Text 2 here.{% endif %}
Can instead be written like this, replacing the endif and the second if with else:
{% if variable == 'Option 1' %}Text here.{% else %}Text 2 here.{% endif %}
Similarly, you can add multiple alternate options by using elif (which means "else if"). For example:
{% if variable == 'Option 1' %}Text here.{% elif variable == 'Option 2' %}Text 2 here.{% elif variable == 'Option 3' %}Text 3 Here{% endif %}