Parsing error in template with multiple images and if/else with icons in table DOCX from Dynamic Template

Hi all,

I am working to create a Word doc in a Process Model w/ DOCX from Dynamic Template that should include text, dynamic text, a table with text, images, and small icons. I have included the bookmarks/links as described in this post: https://community.appian.com/discussions/f/plug-ins/20335/sending-multiple-images-over-a-dynamic-docx-template-smart-service . Below is the template I am currently working off of-

File1.docx

The document I would like to create should look like this (images should be actual images):

File2.docx

The parameters in the process model: 

XmlDataModel: "<slide>" & rule!ERR_formatFieldXML(field: "name", text: ri!slide.slideTitle) & rule!ERR_formatFieldXML(field: "poc", text: "test") & rule!ERR_formatFieldXML(field: "pocType", text: "type") & rule!ERR_formatFieldXML(field: "appetite", text: "Medium") & rule!ERR_formatFieldXML(field: "metricsImgText",text: ri!metricsPage.ImgText
) & rule!ERR_formatFieldXML(field: "metricsImgTwoText",text: ri!metricsPage.ImgTwoText
) & rule!ERR_formatFieldXML(field: "metricsImgThreeText",text: ri!metricsPage.ImgThreeText
) & rule!ERR_formatFieldXML(field: "pageNumber", text: ri!pageNumber) & rule!ERR_formatFieldXML(field: "takeaway",text: ri!metricsPage.text
) & rule!ERR_formatFieldXML(field: "draft",text: if(ri!reportStatusRefId <> cons!ERR_REF_ID_REPORT_STATUS_COMPLETED,cons!ERR_EXPORT_DRAFT_WATERMARK," ")
) & rule!ERR_formatFieldXML(field: "year", text: "2023") & a!forEach(ri!footnotes,
if(
upper(left(fv!item.footnoteText, 5)) = "NOTE:",
"<footnote text = " & "'" & rule!ERR_cleanTextXML(fv!item.footnoteText) & "'" & " />",
"<footnote text = " & "'" & fv!index & ". " & rule!ERR_cleanTextXML(fv!item.footnoteText) & "'" & " />")
) & rule!ERR_formatFieldXML(field: "previousIconKey",text: index(
rule!ERR_decideFourBoxAssessmentTrendIcon(assessmentRefId: 123, trendRefId: 41),
"exportIcon",{}
)) & rule!ERR_formatFieldXML(field: "currentIconKey",text: index(
rule!ERR_decideFourBoxAssessmentTrendIcon(
assessmentRefId: ri!metricsPage.currentAssessmentRefId,
trendRefId: ri!metricsPage.currentTrendRefId),
"exportIcon",
{}
)) & rule!ERR_formatFieldXML(field: "forwardIconKey",text: index(rule!ERR_decideFourBoxAssessmentTrendIcon(assessmentRefId: ri!metricsPage.forwardOutlookRefId,trendRefId: ri!metricsPage.forwardTrendRefId),"exportIcon",{})) & "</slide>"

the format xml rule just takes out whitespace. 

I am getting the error:

Parsing error in template "fr.opensagres.xdocreport.document.docx.DocxReport@77cda313!word/document.xml" in line 4, column 64822:
Unexpected directive, "[/#if]". Check whether you have a valid #if-#elseif-#else structure.

What is the correct syntax for the type of document I want to create? Is there documentation for dynamic templates? Is there any working example with the Dynamic template process model node and also the XML/Template?

  Discussion posts and replies are publicly visible