Survey123 : In a Word report template, conditionnaly display a table

207
4
08-15-2019 08:42 AM
Highlighted
Occasional Contributor

Hello,

Is it possible to conditionnaly display a table depending on the answers entered by the user in Survey123 ?

For instance, I would like to be able to display a table with given "water" results if the category "water" has been selected in the Survey123.

If the category "water" has not been selected, then the table is not displayed.

I thought it would work with the following instructions in the word report template, but it doesn't.

${if ((categories | selected: "water"))}

Table with results for the "water" category

${/}

Do you have a solution ? What would be the right instructions to add to the word report template ?

Thanks a lot!

Tags (2)
Reply
0 Kudos
4 Replies
Highlighted
Occasional Contributor II

Hi,

Yes, it's possible. You need to include the condition into upper left cell of the table, and you need to close the condition in the bottom right cell of the table. If the condition will not be met, the table will not be included into the report at all. Please see below (in my case - if activity type is not pre-work examination, the whole table will be hidden):

PS: the syntax for conditions for pictures changed since I created this template

Reply
0 Kudos
Highlighted
Occasional Contributor

Hello Yulia,

Thanks for the answer. This seems to work well with text type questions but not with select_multiple questions. 

Did you experience the same behavior with your surveys and reports ?

Thanks !

Reply
0 Kudos
Highlighted
New Contributor III

If you use tables and select_multiple questions you'll get every selected answer to a particular question in one cell of the table, not each answer to a new cell. I haven't found any way around that. I just have my users create another row in the feature report Word document and paste each answer into a new row. For my use, that's acceptable as the number of selected multiples are low. Below is another example to add to the one above:

${if D8StabilizeChannels==“No”}S9.D.8 Stabilize Channels and Outlets

${D8Compliance} Stabilize channels and outlets, as set forth in permit condition S9.D.8.

Immediately begin. Address the problems no later than 10 days from the date of this inspection.

C202, C207, C209${/}

Reply
0 Kudos
Highlighted
Occasional Contributor

Hello,

Just a small clarification : in my case the "category" field is a select_multiple. In the template report, I have a table per category that is being filled up with the results of the specific category. I would like the tables for categories that have not been selected on the field, not to be displayed in the final report (built from the report template).

For instance, the user has selected the categories "water" and "air.

The template report has the following structure :

Water table results

Waste table results

Air table results

The final report built from the template should only display :

Water table results

Air table results

What is the nomenclature that should be used for the conditional display of tables in my case ?

Thanks for your help !