Suppress a line in MS Word
Hi,
I created a bot that outputs fields from a Catalytic form onto a MS Word document. Ideally I could use a multiple choice field for this, however I need the choices to show up in list form on the Word doc and unfortunately the multiple choice field separates by commas. As a workaround, I created several choice fields.
I have a total of 7 choice fields, each with the same set of options. The user picks up to 7 unique choices and they display on the Word doc as follows:
{{choice1}}
{{choice2}}
{{choice3}}
etc.
My problem is finding a way to suppress fields that are not populated. Right now, if a user only selects 2 fields and leaves the remaining 5 blank, there are 5 empty lines on the Word doc. Is there a way to modify the field reference on my Word template so that it disappears if no option is selected?
Best Answer
-
@Wes_705161 I believe you can accomplish this by using the syntax to conditionally display those choice values.
In the Word document, if you input each field name like the following, it should show 1 value per line and skip any lines for which there is no value.
My choices:{{#choice1}} {{choice1}}{{/choice1}}{{#choice2}} {{choice2}}{{/choice2}}{{#choice3}} {{choice3}}{{/choice3}}
What the code above is saying is, "If there's a value for choice1, then insert a line break and the value for choice 1. (Repeat for choice2 and choice3.)"
6
Answers
-
Thanks Jeff. This was the original solution I was given but I wasn't separating the fields correctly the first time. Much appreciated
1