I believe I see why this isn't working in your example and it's due to the fact you're not using the full path to the question (you're accessing the question through the flattened answers structure at the top of the reference data). I've attached a video walking through this in a little more detail.
I suspect you could get this working using just the flattened "answers." structure, but you would need to adjust your IF logic to not depend on the selected=true/false.
Original Message:
Sent: 07-26-2024 05:20
From: Peter Dienaar
Subject: Showing MultiSelect box values using Handlebars
Hello,
I tried it out but I still have an issue.
I looks like still only my first selected value is being displayed on my output document.
For an example in Handlebars see attachment
In attachment you can find also an example of the result.
What am I doing wrong here?
Thanks,
Peter
------------------------------
Peter Dienaar
PF developer
Johnson Controls
Original Message:
Sent: 07-24-2024 03:22
From: Peter Dienaar
Subject: Showing MultiSelect box values using Handlebars
Hello Scott,
Thank you very much.
I think this will help me. I will try it out.
Regards,
Peter
Original Message:
Sent: 7/19/2024 12:00:00 PM
From: Scott Daly
Subject: RE: Showing MultiSelect box values using Handlebars
Hi Peter,
Multi-select answer values are stored in an array, so they need to be referenced a little bit differently than other control types.
A great way to see the multi-select array format is to use the Reference data pane on the right side of the custom document editor. This is an example of a single multiselect question (with the question label "MultiSelect"), which contains 4 possible answers (A, B, C, D):
One approach you might use an IF statement for each possible value in the multi-select to conditionally check whether to render a checkmark or unchecked box.
An example piece of code which is illustrating this approach:
{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[0].selected "is" "true"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[0].selected "is" "false"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}} <b>A</b> <br/>
{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[1].selected "is" "true"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[1].selected "is" "false"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}} <b>B</b> <br/>
{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[2].selected "is" "true"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[2].selected "is" "false"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}} <b>C</b> <br/>
{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[3].selected "is" "true"}} <img src="https://cdn.icon-icons.com/icons2/2249/PNG/512/checkbox_marked_outline_icon_139811.png" width="10;" height="10;">{{/pf:if}}{{#pf:if dataRecord.pages.Page1.sections.Section1.answers.MultiSelect.selectOptions.[3].selected "is" "false"}}<img src="https://cdn.icon-icons.com/icons2/3249/PNG/512/checkbox_unchecked_filled_icon_200788.png" width="10;" height="10;">{{/pf:if}} <b>D</b>
This results in the following output when A and C were selected in the form:
I hope this helps!
------------------------------
Scott Daly
Senior Manager, Implementation Services
TrueContext
Original Message:
Sent: 07-19-2024 09:06
From: Peter Dienaar
Subject: Showing MultiSelect box values using Handlebars
Hello,
Does some one have some experience on how to show all selected values from a MultiSelect box using HandleBars?
In my case I have selected 3 values in my MultiSelect but only the first value is showing on my HandleBars output document.
How can a show all values that have been selected?
Thank you,
Peter
------------------------------
Peter Dienaar
PF developer
Johnson Controls
------------------------------