Need to add loop/for each to a Nintex Workflow used to parse XML output from repeating section

  • 11 December 2019
  • 4 replies
  • 25 views

Badge +2

Hello,

 

I am new to Nintex forms and I'm having issues adding a loop/for each to my workflow when parsing an XLM output from my repeating section. I have read all posts on this forum about it and I'm still having issues (probably because I don't have much experience in workflows).

 

I have the parsing working correctly right now, it takes my XML output and spits out the fields in the repeating section but it only does that for the first section. Can someone please walk me through where the loop/for each should be in the workflow and how to make sure it goes through each submitted section?

 

I hope this is clear. Sorry I can't share files or screenshots at this time.


4 replies

Userlevel 6
Badge +22
Hi,

You need to increase the the item number in the xpath on each loop.
e.g.
/RepeaterData/Items/Item[1]/
/RepeaterData/Items/Item[2]/

You can use a variable for this and increase it on each loop.
/RepeaterData/Items/Item[{WorkflowVariable:itemNumber}]/
Badge +2
Hello!
Sorry for the delayed response. Can you please break down what this looks like to me? I'm a beginner in creating Nintex Workflows so I'm not sure how to implement your solution.

I have about 9 fields I'm trying to extract. How would I increase the number on each loop for all?
Userlevel 6
Badge +22

To make things easier just query the XML.
Instead of using the xpath
/RepeaterData/Items/Item[1] or /RepeaterData/Items/Item[{WorkflowVariable:itemNumber}]/
as previously suggested just use:
/RepeaterData/Items/Item
and save it into a collection variable.
Then use a for each loop to go through the collection.
This is simpler and less resource intensive as the XML is only queried once and the for each handles increasing the number on each loop.

Badge +2

Thank you so much!

This is exactly what I needed, problem solved.

Reply