Vaibhav
Nintex Newbie

Repeating control data in formatted

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>

0 Kudos
Reply
1 Reply
Jake
Nintex Employee
Nintex Employee

Re: Repeating control data in formatted

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.

 

Jake_0-1595501323710.png

 

Adding a new output for each field in the repeating section

Jake_1-1595501415349.png

 

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.

 

Jake_2-1595501645377.png

 

The actions should look something like this:

Jake_3-1595502519399.png

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

Jake_9-1595503094387.png

 

 

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

 

header is easy

Jake_4-1595502568193.png

<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.

Jake_5-1595502694604.png

it looks something like this

Jake_6-1595502724677.png

 

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. 

Jake_7-1595502920532.png

 

this is the output we get from your xml

 

Jake_8-1595503013110.png

 

 

0 Kudos
Reply