Hey Scott, thanks so much for the reply! I dabbled with your solution but getting the following error "The following has evaluated to null or missing: ==> row.pages.SLTTable.sections.SLTSubTable.answers.AddTopic_QUESTION_LABEL [in template "body template for Document 'null' (null)"
The question AddTopic defaults to "No" in the repeatable section. It is a button with yes no. I tried changing the field type to checkbox but still failing out. This might be what Calvin mentioned below in terms of referencing expected answers but not sure.
<#list dataRecord.pages.Conclusion.sections.SafetyLetterTopics.rows as row>
<#if (row.pages.SLTTable.sections.SLTSubTable.answers.AddTopic_QUESTION_LABEL.values[0] == "Yes")>
<u>${(row.pages.SLTTable.sections.SLTSubTable.answers.SLTopic.values[0])!""} </u>
-
${(row.pages.SLTTable.sections.SLTSubTable.answers.SLParagraph.values[0])!""}<br><br>
</#if>
</#list>
------------------------------
Luke Greene
Risk Analyst
KONE
------------------------------
Original Message:
Sent: 10-15-2024 15:27
From: Scott Daly
Subject: Freemarker - Filter Repeatable Section Content
Hi Luke,
One approach would be to wrap your SLTopic and SLParagraph output statements in an IF statement which will check to see if your Add Topic question is a certain value (ie. if it's Yes, then print the Topic and Paragraph, otherwise ignore it). The freemarker code for this would look something like this:
<#list dataRecord.pages.SLForm.sections.SLTTable.rows as row>
<#if (row.pages.SafetyLetterTopics.sections.SLTSubTable.answers.AddTopic_QUESTION_LABEL.values[0].display == "YES")>
${(row.pages.SafetyLetterTopics.sections.SLTSubTable.answers.SLTopic.values[0])!""} - ${(row.pages.SafetyLetterTopics.sections.SLTSubTable.answers.SLParagraph.values[0])!""}
</#if>
</#list>
Hope this helps!
------------------------------
Scott Daly
Senior Manager, Implementation Services
TrueContext
Original Message:
Sent: 10-15-2024 12:42
From: Luke Greene
Subject: Freemarker - Filter Repeatable Section Content
Currently trying to create a customized PDF using freemarker. So far so good except for the repeatable section. I am unsure how to filter the results out using the truecontext syntax.
Basically, we have a list in a repeatable section with a question Add Topic (YES/NO button). If Yes is selected, then I have the paragraph auto-add to the PDF. Anyone know how to filter out results of a Repeatable Section in freemarker?
<#list dataRecord.pages.SLForm.sections.SLTTable.rows as row> ${(row.pages.SafetyLetterTopics.sections.SLTSubTable.answers.SLTopic.values[0])!""} - ${(row.pages.SafetyLetterTopics.sections.SLTSubTable.answers.SLParagraph.values[0])!""}
------------------------------
Luke Greene
KONE
------------------------------