Skip to main content

My question is about how to get at the data you caputure in a repeating section in NWC.

 

I know this is a new control, so there may be no answers yet, however in O365 you write the data from a repeating section control to a Multi-lines of text field then parse the XML with with a 'Query XML' action to pull that apart. However, in NWC the repeating section seems to store the data as a Collection/array, not as XML. So, I would have thought you could use Collection operations on that. Not so it would seem: I can use 'Count items in collection' to get the number of sections, but I have tried and failed to use 'Get item from collection' to get values. Not that I can see how that would work anyway - what type of variable do you use to store different data types (say, text and a number) from a section?

 

In case I'm missing something here I'd love to hear from someone to let me know. As it is, I can't see what use repeating sections in NWC have if I can't do anything with the data captured.

An update for anyone interested.



 



Through testing I've found you can use the 'Apply a regular expression' WF action to get at data in a section. This is a bit cumbersome however: you need to count the items in the Collection and then for each section run multiple RexEx actions to get each variable/field from each section. 



 



Again, I would be happy to hear from anyone else if I'm missing something here and there's a better or easier way to get at the data.


I'm using a repeating section in a workflow and I'd like to write the data to a SharePoint Online list. Any ideas how to do this with the data from the repeating section(s)? In this case my section can be repeated up to six times. Since there can be anywhere from one to six sections, how could the data from these sections be obtained and written over to columns in SPO?


As I said above, the only way I've found you can get the data out of a repeating section in NWC for now is to treat the Repeating Section like a Collection and then use a 'Apply a regular express' WF action to extract the data for individual fields in a section. It's clunky, and I expect Nintex will build better functionality to handle repeating sections eventually but as far as I can see this is the only way to do it now.



 



So for example, in your form you have the Repeating section, then in your WF you add a 'Loop for each' action with the target Collection being the Repeating section control. Inside the loop you have an 'Apply a regular expression' action. For that action the Input text will be the 'Loop for each > Object > Current item' with an 'Extract' Operation, to pull out the data for a field.

Before you can construct the regular expression you will need to know what the structure of the data in that Collection item (really, a section) looks like. To get this you will need to run the WF once either with a 'Log to instance details' or 'Send an email' action in the loop to send you an example of what the data in that section looks like - structure, field codes, etc. for everything in the sample section. With that in hand you can then build your regular expression to extract a field of data from the Collection item (section). Add additional 'Apply a regular expression' actions in the loop to extract the values for each field in a section.



 



Take a look online to see how to construct the 'Extract' regular expression. I found there are some good tester tools out there too that let you test your expression on your sample data - unfortunately I forgot to bookmark them.



 



Now you should have the values for each field in a section in separate variables in your loop. Add a SharePoint 'Create an item' action to write those values to a list and your done. The loop will perform the same set of actions for each section in your Repeating section control.


Use a loop for each action in your workflow and use the repeating section control on your start form as the target collection.





Inside your loop for each, you can assign the values of the individual controls contained in the repeating section to variables or reference them in other workflow actions. Example:







More information about the loop for each action can be found here: https://help.nintex.com/en-US/nwc/Content/Designer/Actions/LoopforEach.htm



 


How does this work if you are using NWC to look up data from a list created using an O365 form? The repeater data type is text, not collection. Would I use Query JSON instead?


I'm afraid this doesn't work. Empty strings back every time. It's almost as if the interface is confusing the "value" and "variable to store value in" the wrong way round. Plus there are NO alternate options of getting to the same thing. Very frustrating to be dealing with such a buggy piece of "functionality"


Hi, @fairpoint - if you're referring to @Nintex_Andrea's solution above, I think it's a bit misleading. I was playing around with this yesterday. In your Set a variable value action (inside a Loop for each action), you want to create a new variable for the Variable field, then insert the Loop for each > Current item > Collection variable into the Value field. Here's an example of one of mine:



 





I'm afraid Andrea's solution suggests that the values are set the other way around, which will indeed get you empty strings (as I discovered to my frustration yesterday).


Hi @DavidAD and @fairpoint ,



To provide additional clarity, here's a more detailed breakdown of the solution:





  1. My NWC workflow has an un-authenticated form as the start event. On the form, I have a repeating section control containing 2 controls: Name and Email


     





  2. Here's an overview of the actions in my workflow


  3. The loop for each action is configured with the repeating section from the start form


     





  4. Inside the loop, I have 2 actions: Create a text string and Log to instance details. In the Create a text string action, I am aggregating a list of names and emails from my repeating section on the start form to send in an email later on in the workflow. The text variable I am setting is call txtNamesandEmails. I first insert this variable in the String component field because as the loop repeats, I want to continue to add additional names and emails to the ones previously stored in this variable.



    Then I inserted the Name and Email values for the current item in the loop. To do this, click the insert tab, select the Loop for each category in the insert variables panel, then select the specific loop for each action from the list, then select Current item to expand the current item object





    Once the current item object is expanded, I can insert the Name and Email variables





  5. For the Log to instance details action, I'm following the same steps listed above to insert the Name and Email variables


  6. After the loop action, I'm logging the text variable that contains the aggregated list of names and emails


  7. Then I have configured a Send an email action to email myself the text variable containing the aggregated list of names and emails




  8. When I test this workflow, I fill in multiple names and emails in the repeating section


     





  9. In the instance details I see the data that has been logged


  10. The email I receive looks like this




I hope this helps provide clarity. Please reply with screenshots if you are still having trouble.



Thanks,



Andrea


Thank you for that clarification. My trouble now is sending that repeating section data over to a SharePoint Online list. By creating some conditions in the Update Items action, I've been able to get it to write over the first two sets of repeating-section data (out of a maximum of six) - but after that I'm having problems. What would be the preferred way for me to get some guidance on this?

@DavidAD , please reply with some screen shots of your workflow and action configuration.


Thank you. Here's the repeating section of the form:





The account number and two suffix fields are Text - Short fields (though they will contain numbers).



Here's the beginning of the workflow:





So once the form is submitted, an item is created in SPO with basic data: the employee's name, employee number, request type, and date. Then, as you can see, variables are created for each of the five fields in the repeating section.



Here's the rest of the Loop for each action (as you can see, some of the actions are disabled, because I was testing). I've added an Update items action for each set of the data, up to the limit of six, so that the data will write to a different set of columns in the SPO list.





To update the item in SPO, I'm using three conditions each time: that the data must match the employee name, ID, and date. Plus, for the first set of repeating-section data, I'm also making sure that there's not already a value in two of the fields:





For the second set of data, the account number could be the same as in the first set or it could be different. So when they're different, I've set the conditions like this:





If the account numbers are the same (less likely but possible), the conditions are:





(If the account number is the same, the two suffixes in this set must necessarily be different from the first set.)



Anyway, it all works up to this point. But I can't seem to come up with the right condition(s) for the rest of the data sets - it seems to write the third set of data to the second set of list columns, and then nothing else. At one point it was also stuck in some kind of infinite loop where it kept repeating the Create an item actions.



I have a feeling there's a simpler way to do this, but I can't figure out what it could be. Any help you can give is much appreciated! Thank you.



 



 


Hi @DavidAD. I must be missing something incredibly basic - it really is driving me a little batty. This is what I'm getting:



 



Start the for loop and point it at the repeating section





Start the set variable: 





when I try to set the variable value from the repeating section fields, those values are greyed out:





so I can't assign them as values



 



Does that make sense?



 



The only way I can think of around this is horribly inelegant so I would prefer it if there were a better way. What am I missing?



 



Thanks a mil



M



 


Hi, @fairpoint - in the Set a variable value action, are you creating a variable to store the data? In the Variable field you should click Add variable and create a new variable:





Then, in the Value field, click the +Insert tab. Select the Loop for each category and you should see your Loop for each action listed as an Object.





Click the arrow on that Object, and you should see a Current item Object. Click that arrow and you should see the fields in your repeating section. That's where you choose the one you need.





Does that help?



 


Hi again, @Nintex_Andrea - I think I finally figured out my issue with writing the data from my repeating section over to SharePoint Online. One more condition in the Update items action seems to have done the trick. Thanks for your help!


@DavidAD, I'm glad you were able to solve your problem! Great job! I'm sorry for my delay in response. I'm just getting back to this today.

Reply