Vadim Tabakman

Nintex Workflow - Parsing Nintex Forms Repeating Section in Office 365

Ok, so people have been asking for this, so I decided to put it together.  But, having said that, I'm doing this while on vacation, so as a result... I want you all to go and donate to some good charity.  If it's Autism related, even better!! 1 in 68 kids in the US.  That's just insane!!  Ok, back to the work at hand.

Parsing a Nintex Forms repeating section in Nintex Workflow is a little different in Office 365.  The main reason is this.  When you have a Nintex Form on a list, the data from an instance of that form is used to create an item in a list, but there is also some part that is store in XML, in a field on the item called NFFormData.  Inside that XML, are all your repeating sections and they are stored as an XML document in encoded form.  Since we don't currently have inline functions in Nintex Workflow for Office 365, we don't have a simple way to decode it.  I'll show you one work around for this.  But.... if you don't want to go through this trouble, create yourself a text field on your list and connect your Repeating Section control to it.  The data stored in that field will be the decoded XML version of your repeating section.  Unless of course, if you have a repeating section inside a repeating section.  People do this, but I'm not going to go to that level in this post.

For this post, I'm going to assume you aren't connecting your Repeating Section control to anything, and you want to parse the data the hard way.

Notice.... no video??

You may have noticed earlier that I'm on vacation.  The only time I can put this together is when aa certain grand munchkin is sleeping after a long day.  So no video :)

Form Design

I created a simple form, with a Repeating Section which contains a Label, a Text box and a Calculated Value control.

To make things easier for me, I gave each a name.

Repeating Section - MyRepeatingSection

Label - MyLabel

Text - MyAmount

Calculated Value - MyCalc

Notice the part I made bold.  That's the internal of my repeating section.  But since I named the control, there is an XML node called "MyRepeatingSection".  So all we need to do, is query for that and get it's conttents.

What does the XML Look Like?

Now, when I fill in one form and create three rows of data, the NFFormData field looks something like this (it's been cropped):

<?xml version="1.0" encoding="utf-8"?><FormVariables><Version /><MyRepeatingSection type="System.String">&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&amp;lt;RepeaterData&amp;gt;&amp;lt;Version /&amp;gt;&amp

 

Workflow Design

Firstly, we want to use the Query XML action to query for MyRepeatingSection.

This is using a simple XPath expression, //MyRepeatingSection.  It's the name of your repeating section.  But what happens, is you get something like this back:

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;RepeaterData&gt;&lt;Version /&gt;&lt;Items&gt;&lt;Item&gt;&lt;MyAmount type=&quot;System.Double&quot;&gt;3&lt;/MyAmount&gt;&lt;MyCalculation type=&quot;System.Double&quot;&gt;9.42&lt

 

Now we have to consider, how to convert this back to valid XML.  What we can use the Regular Expression action.

There are a few thins we will need to replace.

&quot; to '  (a single quotation mark)

&lg; to a less than sign

&gt; to a greater than sign.

I like doing this with three Regular Expression actions.

 

The Replace looks like this :

Now that you run these three Regular Expressions, do this one at a time, never in parallel, we can take a look at the XML:

<?xml version='1.0' encoding='utf-8'?><RepeaterData><Version /><Items><Item><MyAmount type='System.Double'>3</MyAmount><MyCalculation type='System.Double'>9.42</MyCalculation></Item><Item><MyAmount type='System.Double'>9</MyAmount><MyCalculation type

 

Notice it's now making more sense.  Next, we want to query each item.

Since I have two controls, MyAmount and MyCalculation, I can use two Query XML actions. Each with their own XPath expressions:

//Item/Mymount

and

//item/MyCalculation

Store these in their own Collection variables.

Now to iterate through these, you can use a For Each and a Collection Operation action.

The workflow design for iterating through related collections looks like this :

Conclusion

You can see that the core of this, is that you use the 3 Regular Expression actions to replace the quot, lt and gt with correct XML node types.  Then you can query the data as you like and use it how you wish.

Now to the important part, the Downloads section.

On-Prem Version of this Post

Downloads

Nintex Workflow for Office 365

Download the Workflow - Download and import into the New Workflow page

Download the Form Design - Download, unzip an import it into the New Form page

Gravatar
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Tuesday, March 8, 2016 10:03:35 AM
Nathan Wright
Gravatar

re: Nintex Workflow - Parsing Nintex Forms Repeating Section in Office 365

Vadim--I've tested this in my O365 environment and confirmed it works. I really appreciate it.

One question--is there any reason you wouldn't just point the repeating list to a text field and skip all of the Regular Expression pieces? That's how I ended up doing it and it seems to work fine. I know that's what you suggested in the intro--is there any drawback in doing it that way?

Finally, are you planning on writing a part two for parsing out repeating sections within repeating sections? I don't have a use case for it, but I'd certainly be interested.

 

Tuesday, March 8, 2016 10:17:09 PM

re: Nintex Workflow - Parsing Nintex Forms Repeating Section in Office 365

Hi Nathan,

not really.  Some people have hit field limits on lists, so this is a one way of saving one field.

I was going to do one on repeating sections in repeating sections.  It'd be similar to this though, with a little extra logic.  Maybe later.

cheers,

Vadim

Thursday, July 7, 2016 1:16:57 AM
Katherine Collins
Gravatar

re: Nintex Workflow - Parsing Nintex Forms Repeating Section in Office 365

Hi Vadim,

Thank for this - I have been looking everywhere for an Office 365 version. I have a question - for the repeating section, do you have one dictionary for each field in the repeating section, or is there a way to store everything in one dictionary?

Thanks,

Katherine

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register





 

Statistics

  • Entries (249)
  • Comments (1729)

Categories