cancel
Showing results for 
Search instead for 
Did you mean: 
brightlight
Nintex Newbie

Get data out of Nested Repeating Section and HTML

Jump to solution

I can get data out of a one repeating section, create items in another list, and update multiline field with a nice HTML table. But, i am not able to do the same more than one repeating section. Can someone put a solution?

Labels: (1)
0 Kudos
Reply
12 Replies
Nintex Employee
Nintex Employee

Re: Get data out of Nested Repeating Section and HTML

Jump to solution
Hi,
The output of a repeating section as you know is XML.
If you nest a repeating section inside a repeating section the nested repeating section will be enoded so that it does not mess up the code structure of the XML.
To use this nested Repeating section I first use a query XML action to extract the node that has the nested encoded repeating section.
Then use a build string action with the fn-XmlDecode() Inline function to decode the xml.
Then run that back through the Query XML action to extract the nodes you need.
0 Kudos
Reply
brightlight
Nintex Newbie

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

I have tried below approach, the workflwo completed without any error but the items do not get created in another list:

https://community.nintex.com/t5/Nintex-for-SharePoint/Getting-Data-From-a-Nested-Embedded-Repeating-...

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

Hi,

It is always good to output or log values as you go along to make things easier to debug.

I created an example of debugging and a nested repeating section senario.

 

Firstly my form. Note that only the Parent repeating section is connected to a SharePoint column.  This SharePoint column must be a Multi Lines of Text column configured as Plain Text.

FormEdit.png

I'm a bit of an F1 fan so I have submitted a form with some racing drivers first and last names.

Two entries in the parent Repeating section which have two child entries.

RepeaterForm.png

When this form is submitted the XML in the list looks like this. (I fixed the formatting to make it easier to read.

<?xml version="1.0" encoding="UTF-8"?>
<RepeaterData>
   <Version />
   <Items>
      <Item>
         <NestedRepeater 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;lt;Items&amp;gt;&amp;lt;Item&amp;gt;&amp;lt;First type=&amp;quot;System.String&amp;quot;&amp;gt;Dan&amp;lt;/First&amp;gt;&amp;lt;Second type=&amp;quot;System.String&amp;quot;&amp;gt;Ric&amp;lt;/Second&amp;gt;&amp;lt;/Item&amp;gt;&amp;lt;Item&amp;gt;&amp;lt;First type=&amp;quot;System.String&amp;quot;&amp;gt;Nico&amp;lt;/First&amp;gt;&amp;lt;Second type=&amp;quot;System.String&amp;quot;&amp;gt;Hulk&amp;lt;/Second&amp;gt;&amp;lt;/Item&amp;gt;&amp;lt;/Items&amp;gt;&amp;lt;/RepeaterData&amp;gt;</NestedRepeater>
      </Item>
      <Item>
         <NestedRepeater 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;lt;Items&amp;gt;&amp;lt;Item&amp;gt;&amp;lt;First type=&amp;quot;System.String&amp;quot;&amp;gt;Seb&amp;lt;/First&amp;gt;&amp;lt;Second type=&amp;quot;System.String&amp;quot;&amp;gt;Vet&amp;lt;/Second&amp;gt;&amp;lt;/Item&amp;gt;&amp;lt;Item&amp;gt;&amp;lt;First type=&amp;quot;System.String&amp;quot;&amp;gt;Charles&amp;lt;/First&amp;gt;&amp;lt;Second type=&amp;quot;System.String&amp;quot;&amp;gt;Lec&amp;lt;/Second&amp;gt;&amp;lt;/Item&amp;gt;&amp;lt;/Items&amp;gt;&amp;lt;/RepeaterData&amp;gt;</NestedRepeater>
      </Item>
   </Items>
</RepeaterData>

So we can see that the Nested Repeater XML is encoded.

In this example I will just pull out the first name of the first entry in the first nested repeater to show that it is possible.  You can expand on this to retreive the rest of the elements data.

 

First action in the workflow will pull out the first nested XML.

XMLAction1.png

The Information retreived will be encoded so we need a Build String action with an inline function to decode it.

BuildStringDecode1.png

IMPORTANT NOTE: This action needs to be run twice as the XML is not fully decoded on the first pass. This may have been the issue of the poster.

 

If we look at the output of the build string after the XML decode it will look like this. For debugging create a Multi Lines of Text column in SharePoint configured as plain text and use an update item action so see the output.  If it is not formatted properly revist the above steps.

<?xml version="1.0" encoding="UTF-8"?>
<RepeaterData>
   <Version />
   <Items>
      <Item>
         <First type="System.String">Dan</First>
         <Second type="System.String">Ric</Second>
      </Item>
      <Item>
         <First type="System.String">Nico</First>
         <Second type="System.String">Hulk</Second>
      </Item>
   </Items>
</RepeaterData>

We can now feed this variable into another Query XML action to retreive what ever I want.

I will extract "Dan" in this example.

QueryNestedXML.png

Now that I have "Dan" stored in a variable I can do what ever I like with it such as creating an item in another list. In this example I have just logged it to the history list for debugging purposes.

 

Workflow Structure.

WorkflowStructure.png

 

0 Kudos
Reply
brightlight
Nintex Newbie

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

Thank you so much @SimonMuntz,

I will test it soon and let you know. 👍👍

0 Kudos
Reply
brightlight
Nintex Newbie

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

@SimonMuntz,

I am not sure why nothing logs into history. Please find my list, form, and workflow in attachment. I really appreciate for you to looking into this.

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: Get data out of Nested Repeating Section and HTML

Jump to solution
Hi,

It looks like your XPATH querys are not correct.
First Query Action you have:
/RepeaterData/Items/Item/NestedRepeater
Should be
/RepeaterData/Items/Item[1]/NestedRepeater

Second Query XML action you have :
/RepeaterData/Items/Item/First
Should be :
/RepeaterData/Items/Item[1]/First

Make these two changes and create a new item on your list and test. It worked for me with the files you provided.
0 Kudos
Reply
brightlight
Nintex Newbie

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

Thank you @SimonMuntz, that worked!!

0 Kudos
Reply
brightlight
Nintex Newbie

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

@SimonMuntz 

I need your help once more.

How would the workflow change if i wanted to write each repeating section rows in another list? Would you be able to send the .nwf file for the writing all parent and child items into another list?

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: Get data out of Nested Repeating Section and HTML

Jump to solution

See attached.

I am just logging the two output variables Fout and Sout but you can replace this action with a create item action to create an item with the two variables into two columns.

If you run this on the previous list template I gave you it will read the XML from the repdata column.

It does not matter how many repeating sections are in the master repeater or the Nested repeater this workflow will work it out.

0 Kudos
Reply