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