I.T. Technician & Systems Developer
Original Message:
Sent: 10-17-2024 09:10
From: Calvin Hunter
Subject: Multiselect box formatting in email destination
Hey Chad, just wanted to follow up on this, sorry about the delay! I did figure out a way to make it work in Handlebars as well! It wasn't that the array wasn't readable, it was just that Handlebars is awkward and doesn't allow expressions within expressions, so @index wasn't working. Seems they added a new helper to work around that problem at some point - lookup.
Here is both methods:
// Freemarker:
<table>
<thead>
<tr>
<th>URL</th>
</tr>
</thead>
<tbody>
<#list dataRecord.pages.Test.sections.Test.answers.Multiselect.values as url>
<tr>
<td><a href="${url}">${dataRecord.pages.Test.sections.Test.answers.Multiselect.valuesMetadata[url?index].display}</a></td>
</tr>
</#list>
</tbody>
</table>
// Handlebars:
<table>
<thead>
<tr>
<th>URL</th>
</tr>
</thead>
<tbody>
{{#each answers.Multiselect}}
<tr>
<td><a href="{{this}}">{{#with (lookup dataRecord.pages.Test.sections.Test.answers.Multiselect.valuesMetadata @index)~}}{{display}}{{/with}}</a></td>
</tr>
{{/each}}
</tbody>
</table>
------------------------------
Calvin Hunter
Project Manager
Vipond Inc
calvin.hunter@vipond.ca
Original Message:
Sent: 10-10-2024 16:09
From: Chad Anderson
Subject: Multiselect box formatting in email destination
Your solution is working amazing thanks again for taking the time to help!
In this section:
<td><a href="{{this}}">{{this}}</a></td>
Do you know if that second {{this}} reference it's possible to use the multiselects 'display' text? Then the URL's get even cleaner looking which would be great
I've been trying to get it working myself for the past few hours but can't seem to figure it out
------------------------------
Chad Anderson
I.T. Technician & Systems Developer
TACADA
AB
Original Message:
Sent: 10-07-2024 16:12
From: Calvin Hunter
Subject: Multiselect box formatting in email destination
No problem - see below. This will just generate a small table of links from your question. "Multiselect" is your question ID. You would just create a custom document (PDF or HTML, below should work in both), select Custom body, and select Handlebars instead of DREL.
TC documentation for custom docs is here: https://docs.truecontext.com/1374411/Content/Published/360000345463.html
Handlebars documentation is here: https://handlebarsjs.com/guide/

<table><thead><tr><th>URL</th></tr></thead><tbody> {{#each answers.Multiselect}}<tr><td><a href="{{this}}">{{this}}</a></td></tr>{{/each}} </tbody></table>
------------------------------
Calvin Hunter
Project Manager
Vipond Inc
calvin.hunter@vipond.ca
Original Message:
Sent: 10-07-2024 12:37
From: Chad Anderson
Subject: Multiselect box formatting in email destination
That would be amazing! I haven't needed anything but DREL so i'm not familiar with those
------------------------------
Chad Anderson
I.T. Technician & Systems Developer
TACADA
AB
Original Message:
Sent: 10-03-2024 14:56
From: Calvin Hunter
Subject: Multiselect box formatting in email destination
Hey Chad,
I can't think of any way to do this with DREL in the e-mail body, but you could do it with Handlebars or Freemarker in a custom text/word/html document that you could attach to the e-mail.
I can whip up an example if needed.
------------------------------
Calvin Hunter
Project Manager
Vipond Inc
calvin.hunter@vipond.ca
Original Message:
Sent: 10-03-2024 12:14
From: Chad Anderson
Subject: Multiselect box formatting in email destination
I'm wanting to create a fairly generic customer feedback form but am running into some issues with how the multiselect box outputs its data. Ideally what I am trying to accomplish is a quick form that our customers can enter their contact info, select from a checklist products that interest them (those checklist items contain the server value of a weblink pointing to our website with the selected product info) and then the output would be an email with the links to all of the products they've selected

The output i'm currently seeing in the email body when selecting all 3 boxes is this:
The output I am looking for would be no brackets, and instead of checklist separation of a comma to use a line break so each selected link is on its own line:
----- Checklist test
https://www.test.com/product1
https://www.test.com/product2
https://www.test.com/product3
I've looked at all of the DREL documentation and tried all of the switches I could see from those pages but nothing changed the output style to something that worked here.
I'm also open to other question types as a solution, but the only one i've tested that has had an output similar to what I'm looking for was individual radio buttons for each product and that lead to other issues such as gaps between the output links if for instance I only select 1 and 3 it looks like:
https://www.test.com/product1
https://www.test.com/product3
Which isn't the worst for small selection sizes but we are planning to have quite a few products in the lists
------------------------------
Chad Anderson
I.T. Technician & Systems Developer
TACADA
AB
------------------------------