A simple way to convert Nintex Forms Repeating section XML data to a HTML table is using a XLS transformation. To do the transformation only one action is needed: Query XML.
Here is a simple example (Forms 2013, Workflow 2013). The form looks like:
Repeating section contains three single line controls named 'last_name', 'first_name', 'company' and is connected to workflow variable 'contacts_xml' of type 'Multiple lines of text'.
XML-content of contacts_xml:
<?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><last_name type="System.String">Lauer</last_name><first_name type="System.String">Manfred</first_name><company type="System.String">KOB</company></Item><Item><last_name type="System.String">Billing</last_name><first_name type="System.String">Emily</first_name><company type="System.String">Nintex</company></Item></Items></RepeaterData>
xml to html transformation is made with a Query XML action. XML source is workflow variable contacts_xml, result will be stored in workflow variable contacts_html
Here is complete XSLT as text:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- transform repeating section from xml to html -->
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="Items">
<table border="1" width="100%" style="border-collapse:collapse;background-color:#eee;border:1px solid;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">
<thead>
<tr>
<td>first name</td>
<td>name</td>
<td>company</td>
</tr>
</thead>
<tbody>
<xsl:apply-templates />
</tbody>
</table>
</xsl:template>
<xsl:template match="Item">
<tr>
<!-- field output order -->
<xsl:apply-templates select="first_name" />
<xsl:apply-templates select="last_name" />
<xsl:apply-templates select="company" />
</tr>
</xsl:template>
<xsl:template match="first_name">
<td>
<xsl:value-of select="." disable-output-escaping="yes"/> </td>
</xsl:template>
<xsl:template match="last_name">
<td>
<xsl:value-of select="." disable-output-escaping="yes"/> </td>
</xsl:template>
<xsl:template match="company">
<td>
<xsl:value-of select="." disable-output-escaping="yes"/> </td>
</xsl:template>
</xsl:stylesheet>
To avoid problems with german Umlauten etc. output escaping has to be disabled because content of repeating section in XML is already encoded.
Resulting html in workflow variable contacts_html:
<table border="1" width="100%" style="border-collapse:collapse;background-color:#eee;border:1px solid;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;"><thead><tr><td>first name</td><td>name</td><td>company</td></tr></thead><tbody><tr><td>Manfred</td><td>Lauer</td><td>KOB</td></tr><tr><td>Emily</td><td>Billing</td><td>Nintex</td></tr></tbody></table>
In Send notification action choose Rich Text and insert by reference workflow variable contacts_html:
Resulting mail looks like:
The look of the table can be changed by using inline css styles.
Example workflow is attached. Comments are welcome.
Manfred Lauer
Nice one!
That's reallly cool to share Manfred!
HI Manfred,
This is fantastic and opens up a world of solutions for me. I am struggling a bit with how to connect the repeating section to a workflow variable?
Would you kindly be able to show me the quick way please?
Thanks
Chet
Hi Chetan
connection is made in settings of Repeating Section control:
Kind regards
Manfred
Sorry I wasn't very clear with my question - I don't see any workflow variable in the "Connected to" menu option only List Columns.
Its obvious I'm missing a step here just not sure what as I've a number of variables within my workflow
Thanks in advance
Chet
You have to define a workflow variable of type Multiple lines of text, then variable is shown in connect dialog:
Hi Manfred,
I tried that and even imported and published your workflow to the site, I created a new repeating section on the form and I can only connect to List Columns as there are not Workflow variables available on the drop-down
Thanks
Chet
Hi Manfred,
I even went as far as raising a support call but was advised this is a design issue even though I believe that I am doing this correctly, I was advised
"As far as your request goes, you would not be able to connect to workflow variables directly from the list form as the variables would not be defined until the workflow has been run, which occurs post form submission"
Is this the case, I'm not sure I understand correctly as the workflow has already run on all list items.
Thanks
Chet
HI Manfred,
I managed to resolve the issue by connecting directly to the list column where the repeating table resides instead of a workflow variable. This is a brilliant solution
Best Regards
Chet
Hi Chet
nice to hear that it works this way.
Kind regards
Manfred