Repeating control data in formatted

  • 22 July 2020
  • 1 reply
  • 15 views

Badge +1

Hello Community, I have a Nintex task form for that reads data from multiline text field but it has data in xml form. Whereas I need in a tabular form. Can someone suggest a way to achieve this?

 

 

<?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><listItemdescription type="System.String">Desc</listItemdescription><listItemNumber type="System.String">Desc</listItemNumber><listSAPInventoryNumber type="System.String">Desc</listSAPInventoryNumber><listRegulatoryBatchCode type="System.String">123</listRegulatoryBatchCode><listQty type="System.String">12</listQty><listUOM type="System.String">ea</listUOM><listLoc type="System.String">12</listLoc><listValueAtStandardCost type="System.String">3001</listValueAtStandardCost></Item></Items></RepeaterData>


1 reply

Userlevel 5
Badge +13

Hello,


 


You would need to use queryXML action in the workflow to first extract all of the information into a collection/dictionary or set of.


 


Then you would loop through each item building a string to list all of the items one after another.


 


Something like this.


 



 


Adding a new output for each field in the repeating section



 


Then running a for each on any of the fields storing the index we can use that to get the information from the other collections (index starting at 0 that is)


 


Creating singular versions of each you can store the individual values in the loop.


 



 


The actions should look something like this:



An example of the collection action is here, repeat this for each field



 


 


Now to build the table you need to build 3 strings, a header, footer and contents


 


header is easy



<table>
<tr>
<th>Item description</th>
<th>Item Number</th>
<th>SAP Inventory Number</th>
<th>Regulatory Batch Code</th>
<th>Qty</th>
<th>UOM</th>
<th>Loc</th>
<th>Value At Standard Cost</th>
</tr>

 


Footer is even easier


</table>

 


For the contents you would build a string like this.


In the for each loop you create the build string.



it looks something like this



 


The important part to note is the use of the output variable for this string builder at the top of the output, This is done so when the loop repeats its self, it will insert everything from the previous loop above the newest item, to reverse direction of items you simply move this variable to the bottom.


 


{WorkflowVariable:tableitems}
<tr>
<td>{WorkflowVariable:Itemdescription}</td>
<td>{WorkflowVariable:ItemNumber}</td>
<td>{WorkflowVariable:SAPInventoryNumber}</td>
<td>{WorkflowVariable:RegulatoryBatchCode}</td>
<td>{WorkflowVariable:Qty}</td>
<td>{WorkflowVariable:UOM}</td>
<td>{WorkflowVariable:Loc}</td>
<td>{WorkflowVariable:ValueAtStandardCost}</td>
</tr>

 


after the loop we combine all of our table variables into a table. 



 


this is the output we get from your xml


 



 


 

Reply