Conditional Phrases
Conditional Phrases or Sentences
You can make the appearance of certain words or phrases 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 phrase 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.
The standard syntax is:
{% if VariableName %}Conditional text here.{% endif %}
How does it work with different question types?
Yes/No Conditional
For conditions dependent on a yes/no question, use:
{% if VariableName %}Conditional text here.{% endif %}
{% if VariableName == False %}Conditional text here.{% endif %}
Multi/Single Select Choice Conditional
For conditions dependent on a Single Select question, use:
{% if VariableName == "option" %}Conditional text here.{% endif %}
You can also use != for "is not," like this:
{% if VariableName != "option" %}Conditional text here.{% endif %}
Example:
Hello. {% if maritalstatus == "married" %}You are married. {% elif maritalstatus == "divorced" %}You are divorced.{% endif %}.
Multi Select Conditional
You can use "all false" as a shortcut where none of the conditions apply, like this:
{% if VariableName.all_false() %}Conditional text here.{% endif %}
Showing a phrase if an answer is blank:
If you want to show some text when the answer is blank, you can use the following. Here it would say "Placeholder text here":
{% if VariableName == "" %} Placeholder text here. {% endif %}
Above, we replaced the option with "" an empty set of single quotes, which means the field was "blank."
Complex Conditionals
A phrase dependent on whether the end-user is married and whose favorite color is pink:
{% if maritalstatus == "Married" and favoritecolor == "Pink" %}I am married and my favorite color is pink! {% endif %}
CSV Conditionals
To create a conditional based on a CSV Data Source response, simply use the same "if" functionality as above. So, for example, you could write:
{% if CSV_Variable["CSV_Column"] == "Jane Doe" %}"