Nintex

Nintex Connect
Metalogix
Metalogix
BlueStripe
BlueStripe

Training - Combined Knowledge

Training - TekDog Inc

Nintex Forms/Workflow - Parsing Repeating Section Data

  • RSS
  • Add To My MSN
  • Add To Windows Live
  • Add To My Yahoo
  • Add To Google

Statistics

  • Entries (121)
  • Comments (316)
Posted by Vadim Tabakman Sunday, July 22, 2012 9:26:00 AM Categories: Iterate Math Calculations Nintex Nintex Forms Nintex Workflow Query XML Repeating Section User Defined Actions

There is an interesting control that you can use in Nintex Forms called the Repeating Section. It gives users who are filling in the form, the ability to dynamically add extra entries.

One example of this, would be a dynamic Annual Leave request form.  Each entry in the Repeating Section would contain a Start Date, End Date and Description. This would save an employee from having to fill in the same form several times, and instead they just fill in the one form.

Although this is a great addition to Nintex Forms, there's no control in SharePoint that can really handle this data nicely.  You need to be able to parse the data that is filled in and do something with it.  In comes Nintex Workflow to the rescue.

Problem

A simple Nintex Form with a Repeating Section that is published to a List.

When a user fills in the form to create an item, they can fill in a number of records in the repeating section.  But once the form is submitting, we need to get the records and do something with them.

This is what the form looks like:

Solution

When a Nintex Form is submitted to a list, the item has a property called "Form Data". This is the XML representation of the entire form.  If we have a repeating section in the form, the form has a hidden ID and the Form Data will have a node with that ID.  So to make it easier for us, we will give our Repeating Section a name like (MyRepeatingSection).

The repeating section will have two Single Line of Text controls.  To make life easier, we will also give them names:

 

To get the value of the repeating section from the XML, we can now use the following XPath expression:

//MyRepeatingSection

The value of this XML node is an encoded XML document.  So we need to decode it using a Build String action and an fn-XmlDecode inline function call.  We now have an XML document that we can query using a Query XML action.

I won't go through example of the Query XML action or the Xml Decoding.  I'll leave this as an exercise for the reader. Instead, I thought that since this part is reusable, I'll create a User Defined Action that will do it for me.  There could be multiple records in my repeating section, so I will get the UDA to return the internal XML document and also the number of internal Items. then

So now that we have the XML and the number of items, we can then use a Loop action to iterate through each item and retrieve the item control values.

I'll leave it up to you to take a look at the UDA and the Workflow, since going through it here is probably super boring.

But what I will provide is a screenshot of calling the User Defined Action.

Copyright Vadim Tabakman

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Wednesday, May 29, 2013 3:16:33 AM Anvar

Hi Vadim:

I just tried to download the user defined action from the above link(Download the Parse Repeating Section Use Defined Action) and import as user defined action, but I see its extension is nwf not uda.

Any help will be appreciated.

Thanks,

Anvar

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Friday, May 10, 2013 8:25:32 AM

That's awesome Josh.  I'm so glad it worked you and you got the solution done so quickly!!

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Friday, May 10, 2013 7:49:25 AM

This works wonderfully Vadim! Thanks so much for this solution. I used the UDA you provided combined with the proposed solution to the safe looping caveat, and was able to get this running in a For Each in no time.

It's working much better than I could have imagined, and was really easy to setup. We're creating line items, validating, and writing calculations back to the parent item from this. We're also able to run approvals on each individual line item and we're even storing everything in the same list (multiple CT's). I see so many potential uses for this.. I'm really happy to have added this to my arsenal!

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Wednesday, May 08, 2013 2:59:57 PM

I've waited forever to have a requirement where I need to actually do something in the workflow related to the repeating section. Oddly enough this has never came up (until now!), even though I use repeating sections regularly. I can't wait to try this out, thanks for the tutorial Vadim! You rock!

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Wednesday, May 01, 2013 7:24:27 PM Jarrad

Hey Vadim, (And those that are trying this but have issues with safe looping taking to long)

I just used this recently to develop a solution but I added in an extra step after the UDA (Query XML) to add the first column of data to a Collection then I used the "For Each" action instead of the "Loop" which is not bound by safe looping and then iterates through the collection for each item with no pause. So basically combined this solution with this one - http://connect.nintex.com/forums/thread/18429.aspx.

Thanks Again.

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 9:56:16 PM

Hi Adam,

I'm gld your have some solution to work with :)

chers,

Vadim

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 5:30:46 PM Adam Pucek

Hello:

I just tried your way...didn't work.  Now that I recall, I actually did try that way, before.  It's OK, pulling it from the field is working fine, so I'll just stick with that for now.  Thanks!

adam

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 5:20:15 PM

Thanks Vadim:

I'll try that tomorrow morning.  I did manage to get it working by using the "connected to" field in the Repeater, and outputting that to a plain text field in my list.  This exposed the encoded XML, which I then decoded as per your instructions in the other post.  It works great, but I still would rather do it the way that you suggest, so I'll let you know how that goes.  Thanks again!

adam

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 5:20:14 PM

Thanks Vadim:

I'll try that tomorrow morning.  I did manage to get it working by using the "connected to" field in the Repeater, and outputting that to a plain text field in my list.  This exposed the encoded XML, which I then decoded as per your instructions in the other post.  It works great, but I still would rather do it the way that you suggest, so I'll let you know how that goes.  Thanks again!

adam

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 12:53:48 PM

Hi Adam,

use a Build String action and then click the Insert Reference.  Choose the Form Data property under Item Properties and store the result in a Text variable.

I think that should do it for you.  I'm not sure why the internal name looks like :_x0024_Resources_x003a_core_x002, but it should still work :).

cheers,

Vadim

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 12:18:35 PM

I should mention, when I choose "Form Data", it converts it to "{ItemProperty:_x0024_Resources_x003a_core_x002}" in the XML filed.

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Thursday, April 11, 2013 12:15:33 PM

Hi Vadim:

I got this working quite nicely, thank you much!  That being said, I have a situation where I need to do this for a hundred or more items.  Because of Safe Looping (a good thing) this takes forever to run.  So I want to combine this solution with this one:  http://connect.nintex.com/forums/thread/18429.aspx

The problem is, I'm not sure how to grab the XML from the Nintex Form to put it into a string in the first place.  I tried selecting "Form Data" from the "Item Properties"...no go.

Is it even possible to do what I'm trying to do?  Thanks!!

adam

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Monday, March 04, 2013 4:43:08 AM unknown

thank you Vadim. nice article

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Wednesday, January 30, 2013 10:10:58 AM

Hi Simon,

if you're using a Loop action, you hit the nail on the head - Safe Looping. :)

cheers,

Vadim

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Wednesday, January 30, 2013 7:32:19 AM Simon

 

Not to worry, I found some info on Safe Looping which I'm sure is this problem.  about to switch it off

 

Simon

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Wednesday, January 30, 2013 7:15:13 AM Simon

Hi

Hope you don't mind helping me with an issue I have regarding the above.

I have implemented your method above, more or less as is, on our test server.  It works fine, does what it is meant to but it takes ages to do it ... see below

I have 3 repeating sections, with two textboxes like yours.

can you think of any reason why it would run so slowly?  It appears to be taking ages to do the maths of adding 1 but perhaps that is misleading!

Action Start

Math operation 30/01/2013 12:05

Log in history list 30/01/2013 12:05

Query XML 30/01/2013 12:05

Math operation 30/01/2013 12:00

Log in history list 30/01/2013 12:00

Query XML 30/01/2013 12:00

Math operation 30/01/2013 11:57

Log in history list 30/01/2013 11:57

Query XML 30/01/2013 11:57

Loop 30/01/2013 11:57

Update item 30/01/2013 11:57

Log in history list 30/01/2013 11:57

Set variable 30/01/2013 11:57

Get Forms Repeating Section UDA 30/01/2013 11:57

-------------------------------------------------------------

30/01/2013 11:57 Workflow Comment 3  
30/01/2013 11:57 Workflow Comment frrrrr  
30/01/2013 12:00 Workflow Comment fjffjfjfjfj  
30/01/2013 12:05 Workflow Comment sgsgdsgsgs great

Thanks

Simon

 

 

re: Nintex Forms/Workflow - Parsing Repeating Section Data

Sunday, September 30, 2012 10:34:23 PM

Hi Brijesh,

I'm afraid I don't know how to do that yet.

cheers,

Vadim

Nintex Forms - Publish using Code

Friday, August 31, 2012 3:01:06 AM Brijesh

Hi,

Do you have any idea about how to import/publish a Nintex Forms 2010 using a code ?

~Brijesh