[Solved] How to create Repeating Section in PowerApps and save data to SharePoint List - Netwoven

[Solved] How to create Repeating Section in PowerApps and save data to SharePoint List

By Baishakhi Adhikary  •  August 13, 2020  •  18967 Views

How to create Repeating Section in PowerApps and save data to SharePoint List

PowerApps is surely gaining traction among business users due its low code no code approach and easy integration with a variety of data stores and apps. However, there are occasions when certain controls are not readily available and one needs to apply few tweaks to achieve the desired result. We faced one such situation in our project and I wish to discuss that in this article. 

In one of our recent projects we needed to  migrate some Nintex forms integrated with SharePoint list to Power Platform. These Nintex forms had some repeating sections. 

What is Repeating Section? 

Repeating Section in Nintex is a control which can contain a set of other controls and allows a user of the form to insert multiple instances (rows) of data as required. A typical use is to capture personal details such as multiple phone numbers of a person as shown below. The type of phone and its number are small controls that are repeating to capture multiple sets of data. The trouble is  the child controls are connected to the Repeating Section control and thus cannot be directly connected to SharePoint list columns or fields. 

How to create Repeating Section in PowerApps and save data to SharePoint List

Also, in PowerApps we do not have any default control like repeating section in Nintex form.  

How to create repeating sections in PowerApps? 

You have guessed it! We need to mix few things in PowerApps to get to the point. I created the repeating section in PowerApps using form, gallery, and button controls. 

Follow through the steps below to create a. Repeating Section in PowerApps and also saving data from this section to the SharePoint list. 

Steps:

  1. Create a list column of type multiple lines of text in your SharePoint list to store the data from repeating section. Just like here I have a column named ‘Repeating Section Data’.
How to create Repeating Section in PowerApps and save data to SharePoint List

2. In PowerApps screen, add the edit form which will be connected to your SharePoint list and hide the column ‘Repeating Section Data’.

How to create Repeating Section in PowerApps and save data to SharePoint List

3. The repeating section cannot be created inside your form. You must create the section outside the form.

4. Add a gallery with the controls you need to save data for the repeating section and a ‘x’ (cancel) button. Also, below the gallery add a ‘+’ icon to add rows and a save icon to save data in all the rows. This should look something like this:

How to create Repeating Section in PowerApps and save data to SharePoint List

5. In the ‘OnSelect’ property of the ‘+’ icon add these lines of code.

Collect (CollRepSec,
    {
        SrNo: Text (2 + (CountRows (CollRepSec) + 1) / 10),
        Type: "",
        Description: ""
    }
);
How to create Repeating Section in PowerApps and save data to SharePoint List

6. In the gallery’s Items property, add collection “ColRepSec”.

How to create Repeating Section in PowerApps and save data to SharePoint List

7. Edit the Fields property of the gallery and add the respective fields to each of the controls.

How to create Repeating Section in PowerApps and save data to SharePoint List

8. Now, add the following code in the cancel button of the gallery.

RemoveIf (CollRepSec, SrNo = ThisItem.SrNo);
How to create Repeating Section in PowerApps and save data to SharePoint List

9. In the ‘OnSelect’ property of the save icon add the following lines of code:

UpdateContext (  
    {  
        RepSecCOllString: Concat (  
            GalleryRepSec.AllItems,  
            Concatenate (
                 LabelSrNo.Text,
                 ";",
                DropdownType.Selected.Value,  
                ";",  
                TextInputDesc.Text,    
                “;”,
                "|"  
            )  
        )  
    }  
);
How to create Repeating Section in PowerApps and save data to SharePoint List

10. Now add the variable ‘RepSecCollString” to the Update property of your ‘Repeating Section Data’ data card in the form.       

How to create Repeating Section in PowerApps and save data to SharePoint List

11. Make sure to clear the collection ‘ColRepSec’ by adding the following code in the OnNew property of the SharePointIntegration in your form.

Clear (CollRepSec);

There you are. Now when you add rows in the repeating section the form will look like this.

How to create Repeating Section in PowerApps and save data to SharePoint List

And when you save it the data is being saved in the list like this.

As I said, many people are moving to PowerApps from their existing system. The existing forms could be InfoPath, Nintex like in our case or even some custom applications. The source really doesn’t matter as long as you are able to mimic the control within PowerApps and also save the data into native SharePoint data store.

Hope you will be able to use the artefact described here for your purposes and I would feel happy if you do. Let me know for more assistance.

It may also be needed to later retrieve the data and be able to edit it. That’s exactly my plan to discuss it in the next article!

13 comments

    1. You can do it several ways. What I can suggest is to check the Collection length.. If it reaches the value 10 then disable the “Add new row”.

  1. So, you have to click custom save button to save rows into variable and then click save button to add record into list

  2. “It may also be needed to later retrieve the data and be able to edit it. That’s exactly my plan to discuss it in the next article!”

    Any plans on that next article?

  3. Hi – Thanks for sharing fantatsic info. I am looking to attempt something like this. For example if Employee has two phone numbers, it should be captured as two different rows with all attributes of Employee getting repeated except Phone number. The next row should capture address with the employee attributes remaining constant. Both phone number and address should be populated in the column communication. Can you please help?

    Emp Name Emp ID Communication
    Ram 123 888888888
    Ram 123 999999999

  4. Hi,
    I tried the same,
    But when I open my repeating table, it is empty.
    each time i have to click “+” to generate a new record
    can i show the first row by defualt

  5. I have a field in my repeating table that I would like to be able to sum the value of. Each row has a dollar value and I need the total of all those fields for an approval. Is this possible?

  6. when I go to use the code, things seem ok, other that the 2.1 2.2 doesnt work…
    and when I go to try to update the item. lets say the next day or even wait 1 hr to update the item, it doesnt keep the prior entered infomation it writes over it..

    how do I keep the old items and append the new items to the entries in the repeating section???

Leave a comment

Your email address will not be published. Required fields are marked *

Dublin Chamber of Commerce
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Partner
Microsoft Fast Track
Microsoft Partner
Microsoft Fabric
MISA
MISA
Unravel The Complex
Stay Connected

Subscribe and receive the latest insights

Netwoven Inc. - Microsoft Solutions Partner

Get involved by tagging Netwoven experiences using our official hashtag #UnravelTheComplex