cancel
Showing results for 
Search instead for 
Did you mean: 

How To: Extracting XML Data from a Repeating Section

Nintex Employee
Nintex Employee
2 3 1,047

How to create an itemized list of all data within a repeating section on your form. In this blog we will discuss how to leverage Query XML, Loops, Collections, and Document Generation actions.

 

We have all ran into this scenario before: "I need to be able to submit multiple (insert things to submit here) but in one single form." This is not a new concept of having a form that allows for multiple items within it, nor is the idea of how to go about collecting that data anything new. However, there does seem to be some different approaches on what to do with the data AFTER it has been submitted. Here is how I would approach this scenario, but please, let me know what you think in the comments below and what you would change or how you would go about architecting a solution like this. Let's jump in!

 

Hands-on approach

If you are looking for a hands-on approach to repeating sections, check out the blog by @eharris04  on How to get data from a form repeating section in O365.

 

Scenario

I have a form that I use to request banking information. I know the bank name and location, but need to know additional information for each one. Rather than fill out a form for each bank, I can use a repeating section to capture each request and process the entire form altogether.

 

Things you'll need if following along:

SharePoint list - data entry (form)

SharePoint list - create an itemized list of request

Document Library - the document is generated at end of a workflow (used in the second part) - more to come on this!

 

Form

I am not going to go into great detail on how to design the form, but there is one specific piece that needs to be addressed. In my SharePoint list, I have multiple lines of text column named RepeatingSectionXML. This colum will be used in the form and connected to the repeating section. This allows me to capture all of the data that is being entered into the repeating section and usable within my workflow.RepeatingSectionXML.PNGRepeatingSectionXML

Here is the published form (filled out):Form.PNGPublished Form

 

Workflow

Now that the form is setup and we are collecting the XML data in a list column, we can move on the building out our workflow to break it apart and push it to an itemized list.

First step: Get Data from Repeating Section XML

I use a parallel action to get all of the elements I need and store them into collection variables. For the above banking example, it will look like this:GetData from XML.PNGGet Data from Repeating Section

And here is a closer look at the Query XML actions:Query XML specifics.PNGQuery XML

Be sure your XPath query is accurate. I recommend using something like https://www.freeformatter.com/xpath-tester.html to test and validate your query.

 

Second step, now that we have all the needed data points in collections, is to simply loop through them and create a new item in our itemized list in SharePoint. GetData from Collections.PNGLoop through Data and Create List Item

We begin our loop by pulling out data for each Bank and then getting the data from the Location collection at the same index:GetData from Collection specifics.PNGGet Location from Collection

At this point we have both the Bank Name and Location that was requested and can send it to the Itemized list for further processing. This is as simple as leveraging the Create Item in List action setup like this:Create New Item specifics.PNGCreate Item in Itemized List

You'll notice that we are storing the newly created SharePoint item ID in a variable so that we can save it and use later. Here, we may also want to consider adding some more content to the new item as we are creating it. Perhaps the {currentItem:ID}? If we add a reference to the "parent" item (the form we filled out in the beginning), we can perform lookups later on in another workflow or process to ensure updates happen if needed. Last step is to add the item ID to a collection and we can do so like this:Add Item to Collection specifics.PNGAdd SP ID to Collection

 

At this point, we have filled out a form to request additional information on some banks. This data was stored in a repeating section (XML) and we used that data to create an itemized view in another list (via query XML, looping, and create item actions). The main focus was how to parse through the XML and do something with it. For this scenario, we broke it apart and send each item to a new list. From here, you can replace all of the actions inside the loop with whatever actions you need to perform for your specific process/workflow.

 

In this example, we have one more step; Document Generation.DocGen Specifics.PNGDocument Generation

 

I am generating an Excel sheet of all of the Bank Names, Locations, and SharePoint IDs that will be used for lookup the additional required data. The reason I am doing this is because the information that needs to be referenced is on the FDIC website and will be scraped using out Foxtrot RPA offering.  I will cover that part of the process next time!

 

 

Sneak preview into the next blog

Did you know that you can kick off a bot in Foxtrot via a file trigger? That's right, we can trigger a bot within Foxtrot with the document that I just created!Foxtrot File Trigger.PNGFoxtrot RPA - File Trigger

 

3 Comments
deanvirag
Nintex Newbie

Great post. I have a requirement in which this post solves. But... here is my issue. In my repeating section I have 2 list lookups that cascade. I have all that working. My issue is that the XML that is generated contains the ID for the lookup lists items and not the Title.  Here is my XML:

 

<?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><SelectSiteCollection type="System.String">53</SelectSiteCollection><SelectSites type="System.String">55;#;#53;#;#60;#;#66;#;#67;#</SelectSites><Select_x0020_Permission_x0020_Level type="System.String"> Contribute (Add/Edit/Delete Content)</Select_x0020_Permission_x0020_Level><SpecialSharePointAccess type="System.String"></SpecialSharePointAccess></Item><Item><SelectSiteCollection type="System.String">3</SelectSiteCollection><SelectSites type="System.String">14;#;#18;#</SelectSites><Select_x0020_Permission_x0020_Level type="System.String">Visitor (Read/View Only)</Select_x0020_Permission_x0020_Level><SpecialSharePointAccess type="System.String"></SpecialSharePointAccess></Item></Items></RepeaterData>

 

How do I get the lookup list title and not the ID into the XML?

 

Thanks

Dean Virag

deanvirag
Nintex Newbie

Update: My issue was solved..

 

This is normal, it's the way the repeting section save values of list lookup.

 

But, if you want to save the Text of your listLookup in the XML that your repeting section generate, you can ADD a "Calculated value" in your repeting section whitch display the text of your listLookup control. (use the function parseLookup to get only the text in the formula of your calculated value). In this way, the text of your control "Calculated value" will be save in the XML of your Repeting section."

 

SherryH
Nintex Newbie

Hi, There isn't any workflow file in the zip files  and pictures are not helpful either @ Hands on approach

If you are looking for a hands-on approach to repeating sections, check out the blog by @eharris04  on How to get data from a form repeating section in O365.