This has been discussed ad nauseum in countless threads, but I cannot for the life of me find how to correctly provision the workflow to iterate through the collection.
Let's say I have a repeating section with a single text field that a user can add to.
The xml will look like this, in my RepeatingSection column (plain text, multiline):
<?xml version="1.0" encoding="utf-8"?>
<Item><Thing type="System.String">First thing</Thing></Item>
<Item><Thing type="System.String">Second thing</Thing></Item>
<Item><Thing type="System.String">Third thing</Thing></Item>
I know I need to use Query XML to get the collection information, but I don't know how to set it up correctly. I can drill down to the "Thing" item that I want, but do I keep the  as the index when initially querying? If I set it to a WF variable, it doesn't work.
Here are my variables:
My For each loop performs a Collection operation to Get items from the collection (at least that's the idea)
Here is the For each:
And the Collection operation:
Which should update another plain multiline with the Thing(s) texts:
Except it only grabs the first item, which is "First thing" and helpfully logs: "Index 0 has thing First thing" which is correct but not exactly what I want.
Why is it not looping through the collection?
Solved! Go to Solution.
Hey thanks @Aleximo ! Turns out it was as easy as identifying the //Item, since that's the only thing in the node. For "real" items with more fields, your suggestion will work perfectly. Thanks!
The For loop and Collection operation were configured correctly.
My biggest trouble is finding good, pertinent examples on this Community site. I wish the documentation had some examples.