Reference a Repeating Item Question

You can reference the answers to a repeating item question in a subsequent question by adding it to your workflow questions, then using the syntax below in your document.  Follow the two steps below:

1. Add the repeating item reference question to your workflow

First, add a repeating item question.

Then, add a multiple choice/checkbox/dropdown question and select Reference a repeating item question.

You will see the below, where you can select the repeating item you're referencing, and up to two attributes:

alt text here

2. Add the variables into your document

For this feature, you'll need to copy and paste the code below. This code will come to the Word add-in soon.  Choose the appropriate code based on the type of question you are asking:

Option 1: Regular Multiple Choice/Dropdown/Combobox question referencing a Repeat

Copy and paste this with your own variables:

{{ ItemName[ReferenceQuestionVariable|int].ItemAttribute }}


In the example in the picture above, this would be:

{{ children[favorite_child|int].child_first_name }} {{ children[favorite_child|int].child_last_name }}

Option 2: Regular Checkbox question referencing a Repeat

Copy and paste this with your own variables:{% for item in ItemName %}{% if ReferenceQuestion[loop.index0|string] %}{{ item.ItemAttribute }}{% endif %}{% endfor %}


To add commas and "and" in between, use this:{% for item in ItemName %}{% if loop.last and not loop.first %}and{% endif %}{% if ReferenceQuestion[loop.index0|string] %} {{ item.ItemAttribute }}, {% endif %}{% endfor %}


In the example in the picture above, this would be:

{% for item in children %}{% if favorite_child[loop.index0|string] %}{{ item.child_first_name }} {{ item.child_last_name }}{% endif %}{% endfor %}

Option 3: Repeating Item question referencing a Repeat

Copy and paste this with your own variables:{% for item in SecondItemName %}{{ ItemName[item.SecondItemAttribute|int].ItemAttribute }}{% endfor %}


In an example where the second repeating item is asking about grandchildren (see image at the bottom of page) and who they belong to, this would be:

{% for item in grandchildren %}My child {{ item.grandchildname }} belongs to {{ children[item.grandchildparent|int].child_first_name }}{% endfor %}

Example of Option 3 in the Questionnaire:

alt text here