Multi Select Responses
There's a lot you can do with the answers to Multi Select questions. Have responses appear as a lists, or set logic based on how many Multi Select selections were made.
Having Multi Select Items Appear as a Bulleted List or Table Rows
But you can also have a Multi Select question trigger a bulleted list or a table with each Multi Select entry on a line of the table, as follows
Bulleted List
This will show all your checked Multi Select options, each on a separate bulleted line:
- {% for item in variablename.true_values() %}
- {{ item }}
- {% endfor %}
Table with Rows of Options
Add each of the following lines to a separate row in a table in your document to have each checked Multi Select option display on a separate row of the generated table. Note: In the below, "item" should just list the word "item," and not be replaced with another word.
{%tr for item in variablename.true_values() %}
{{ item }}
{%tr endfor %}
Watch this video for a more detailed explanation of this process:
Count the Number of Multi Select Items Chosen
This will display the number of Multi Select items chosen:
{{ variablename.number() }}
Logic Based on How Many Multi Select Responses Were Chosen
Let's say you want to display some text in your document if more than 2 of your Multi Select choices were selected. You can do this:
{% if variablename.number() > 2 %} You chose more than 2! {% endif %}
Non-Alphabetical Order
By default, Multi Select answers will appear in alphabetical order in your document, but you can have them appear in the order you listed them by using the following:
{% for key, value in variablename.elements.items() if value %}{{ key }} {% endfor %}
Non-Alphabetical comma-separated
{% for key, value in variablename.elements.items() if value %}{{ key }}{% if not loop.last %}; {% else %}.{% endif %}{% endfor %}
Displaying Multi Select Choices that are not "Other"
If you have a list of Multi Select choices, but one of them is "Other," you may not want the words "Other" to appear in your list. In that case, use the following syntax to exclude the "Other" option:
{% for key, value in variablename.elements.items()%}{% if value and key != “Other” %}
• {{ key }}
{% endif %}{% endfor %}