Nintex Workflow – Reverse Parsing Collections
Parsing collections is often used in Nintex Workflows. I showed it here in an old blog post – Iterate through Related Collections. But what came up recently, was reverse parsing collections.
That was an interesting challenge, since what I didn’t want to do, is use a Loop action. Why? Because a Loop is affected by Safe Looping, and I know that all of you have Safe Looping enabled in your production environments. Right? 🙂
So the concept is very similar to the above blog post about Iterating through related collections. But, instead of using the index from the For Each, we actually get a Count of one of the collections. We then subtract 1 from that.
You are probably wondering why we are subtracting 1. Well, in Nintex Workflow, the indexes (indices?) work on a number system that starts counting from 0, not from 1. So the first position in a collection is in index 0.
If you have 3 items in a collection, the index of the last item is 2. This has you thinking, hasn’t it?? 🙂
Here is what the workflow looks like (shrunk down):
Now you’re probably wondering, why didn’t I make this into a User Defined Action? Well, the workflow itself is built in such a way, that it is looking for specific nodes in the XML, which would be different for everyone here who builds workflows and forms. So the aim of this post, is to show you a concept of how to do this. Then you can take this and wrap it into a UDA and reuse it.
I hope this gets your thinking and inspired to build your own parsing workflow logic.
Download the Workflow – Download and import into the New Workflow page