Nintex Forms Repeating Control two way sync with child list

  • 2 October 2017
  • 3 replies
  • 66 views

Badge +5

Though I have been working with Nintex Forms and Nintex workflows for a long time I didn't happen to realize how versatile and fun to work with repeating sections on the forms in conjunction with Nintex workflows. Long story short, I always had this common requirement from Infopath form days till a new project I implemented purely with Nintex, that is none other than having an ability to report and update the repeating table rows using spreadsheet view in the SharePoint.

 

Until I come across a great post written by Vadim Tabakman parse repeating section data I felt it is not possible help clients with such requirements without code, but Vadim Tabakman's posting changed the way how I looked at NIntex Forms. Though the idea of parsing data taken from his post, I wrote the workflow steps in little different way to not to use the loop action instead stick to for each action due to loop action being dependent on turning off safe looping setting which I personally dislike taking that setting off.

 

Problem:

Repeating section rows will not come with row numbers, and also they can not be appeared in direct list columns because of the their one to many nature. Thus not allowing it for edit in excel mode.

 

Solution:

The direction I am taking to address above is create a child list and main the repeating table data in the child list while storing their item IDs in the repeating table hidden rows for later use of update. while my project was pretty complex with bunch of look up fields and all data types like dates, numbers and persons, for the easier understanding of concept I created  a separate project and will make use of that here. 

 

We need two simple lists for implementing the solution. First list I am naming NintexPOC for keeping it simple with just 2 columns 1. Title  2.MyRepeatingData - mulitline text plain.

Second list I am naming as Expense Records with 4 simple columns such as 1. Title 2. Expense Date 3. Amount and 4. ParentItemID(this is a look up field from NintexPOC to maintain parent child relationship).

 

Part 1: Now let us start with key element of the solution, that is our form with repeating section. I placed the names of each control in the repeating section in red font on the screenshot for readability. Provide your repeating section a name and also connect it to the multi-line text field we created in the list. Inside repeating section also keep a control for storing child list item id and make it hidden if you don't wish to display it to the user.

208766_pastedImage_1.png

Once you connect the repeating section to multi-line text field and publish, create your sample data to give a peak at how Nintex generating the XML  for us. when you save an item at least with one repeating section row filled with data this is how it is going to look like.

NintexPOC - All Items

<?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><EName type="System.String">User2</EName><ExpDate type="System.DateTime">7/3/2017</ExpDate><ExpAmount type="System.String">500</ExpAmount><ChildItemID type="System.String">10</ChildItemID></Item><Item><EName type="System.String">UserOne</EName><ExpDate type="System.DateTime">7/25/2017</ExpDate><ExpAmount type="System.String">100</ExpAmount><ChildItemID type="System.String">7</ChildItemID></Item></Items></RepeaterData>

Part 2: Now its time for us to switch to workflow part of our solution which is where the greater possibilities with Get XML action and collection objects unfold.

As a step 1 simply get your multi-line text field data into workflow variable and add regular expression action in the workflow right after that. Configure the Regular expression step like below

208768_pastedImage_1.png

For the purpose of building for loop action we need one dummy text field, we will use this only for setting up in for loop action box and won't use any where. Also create a number field with name Index and set default value as 1 to start with. This index variable is the key in the next steps. inside for loop we will also be keep doing increment it by 1 in each iteration.

208769_pastedImage_2.png 

Inside for loop action, now add Query xml action and add output blocks like below until you get all your named controls to variables. 

 

208770_pastedImage_3.png

we will check if child item id is blank, if not blank that means we have an existing item so can update instead of creating new. If child id doesn't exist then create new item and get the newly created item id and store it back in the xml field with Update XML action.

208771_pastedImage_4.png

 

End of workflow update current item with updated XML back to our multi-line text field. Now that we have each repeating row assigned with its corresponding list item id, when the child list items change we can use item updated workflow and update that specific row in the repeating row. It is much simpler workflow without any loops and explaining it here would be too boring to read happy.png . Attaching full solution for download including list templates and both workflows.


3 replies

Badge +1

Hi Jaya,

I'm relatively new to Nintex. I see you have several workflows and files in your zip. Can you please tell me where each should go, whether in the parent or child list please?

Thank you in advance,

Licet

Badge +4

Hi am curious to know as well.

I believe it is like this:

PopulateExpenseTbl.nwf = ReaptingTblPOC - Got this to work

UpdateNintexPOC.nwf = ReaptingTblPOCChild - Got this to work

CreateRepatingItem.nwf = ReaptingTblPOCChild - I could not figure this one out.

I too am fairly new to this but after having spent time explaining to the end user that when you edit the child list those changes will just disappear when someone saves in the parent list this seems like a worth while solution. 

Maybe I am just confused about the setup.

Thanks, This looks good.

Edit: I was able to find something similar here that got me up and working. Nintex Workflow - Order and Order Items Relationship - Vadim Tabakman 

I just need to figure out how to handle deleting the rows from the child list if row is deleted in the parent list.

Badge +9

Jaya Borra,

All good except i need to create child items when repeating section rows are modified, any ideas?

Reply