Create Repeating Section In PowerApps Edit Form - Step By Step - Part Two

Overview

 
In this article, we will create the Repeating Section with PowerApps forms in Edit Form.
 
I divided the creation of Repeating section into two parts. If you didn’t visit the first part of this article, please visit my first article.
So, now let’s get started!
 
In Part 1 of the article, we have created the concatenated string to store the value of the repeating section. Here, we need to retrieve those values in the Edit mode of the form.
 
The basic concept we are going to use here is,
  • We will create the Edit Form.
  • We will navigate to Edit Form using PowerApps Gallery Grid.
  • On Select of the Gallery, we will get the context of the selected item.
  • Once we get the selected item, we will store concatenated value into one variable.
  • On Screen ‘s Visible event we will parse the string and show the values in the Repeating Section.
Download Code
 
I added the code to download for your practice on GITHUB.
 
Let’s get started!
 
Step 1
 
Below is the Home Page of the app.
 
Write the below code on the “OnSelect” event of the gallery.
  1. Navigate(EditPage,ScreenTransition.None,{SelectedItem:Gallery1.Selected})  
Create Repeating Section In PowerApps Edit Form
 
Step 2
  1. Let’s create an Edit Page.
  2. Create a New screen and add Edit Form. Hide the repeating section.

    Create Repeating Section In PowerApps Edit Form

  3. Add the following code in below events of the form.

Data Source

 
Select WO.
 
Create Repeating Section In PowerApps Edit Form

Item

 
Add “SelectedItem” which we have passed as a variable in step 1.2
 
Create Repeating Section In PowerApps Edit Form

Add the following code snippet in the OnVisible event of the edit form.
  1. UpdateContext({EditStringVal: SelectedItem.RepeatedSection});  
  2. Clear(EditCols);  
  3. Set(  
  4.     Editstr,  
  5.     SelectedItem.RepeatedSection  
  6. );  
  7. Set(  
  8.     Editstr,  
  9.     Left(  
  10.         Editstr,  
  11.         Len(Editstr) - 1  
  12.     )  
  13. );  
  14. ForAll(  
  15.     Split(  
  16.         Editstr,  
  17.         "|"  
  18.     ),  
  19.     Collect(  
  20.         EditCols,  
  21.         {  
  22.             CItemSerialNumber: Text(  
  23.                 Last(  
  24.                     FirstN(  
  25.                         Split(  
  26.                             Result,  
  27.                             ";"  
  28.                         ).Result,  
  29.                         1  
  30.                     ).Result  
  31.                 ).Result  
  32.             ),  
  33.             Clevel: Text(  
  34.                 Last(  
  35.                     FirstN(  
  36.                         Split(  
  37.                             Result,  
  38.                             ";"  
  39.                         ).Result,  
  40.                         2  
  41.                     ).Result  
  42.                 ).Result  
  43.             ),  
  44.             Ctc: Text(  
  45.                 Last(  
  46.                     FirstN(  
  47.                         Split(  
  48.                             Result,  
  49.                             ";"  
  50.                         ).Result,  
  51.                         3  
  52.                     ).Result  
  53.                 ).Result  
  54.             ),  
  55.             Cdescription: Text(  
  56.                 Last(  
  57.                     FirstN(  
  58.                         Split(  
  59.                             Result,  
  60.                             ";"  
  61.                         ).Result,  
  62.                         4  
  63.                     ).Result  
  64.                 ).Result  
  65.             )  
  66.         }  
  67.     )  
  68. )  
Create Repeating Section In PowerApps Edit Form
 
Now let’s add the Gallery control with labels, buttons, and dropdowns.
 
Create Repeating Section In PowerApps Edit Form 
 
In Items > Add “EditCols” collection which we have created in the above section.
 
Now, let’s add the code snippet for the following sections.
 
Create Repeating Section In PowerApps Edit Form 
 
New button Code
  1. Collect(  
  2.     EditCols,  
  3.     {  
  4.         CItemSerialNumber: Text(Last(EditCols).CItemSerialNumber + 1),  
  5.         Clevel: "",  
  6.         Ctc: "",  
  7.         Cdescription: ""  
  8.     }  
  9. )  
Create Repeating Section In PowerApps Edit Form
 
Close Button Code
  1. RemoveIf(EditCols,CItemSerialNumber = ThisItem.CItemSerialNumber)  
Create Repeating Section In PowerApps Edit Form
 
Save button Code
  1. UpdateContext(  
  2.     {  
  3.         EditStringVal: Concat(  
  4.             RepeattingTable_3.AllItems,  
  5.             Concatenate(  
  6.                 'sr.no_edit'.Text,  
  7.                 ";",  
  8.                 drpedit.SelectedText.Value,  
  9.                 ";",  
  10.                 technicalcontent_edit.Text,  
  11.                 ";",  
  12.                 description_edit.Text,  
  13.                 ";",  
  14.                 "|"  
  15.             )  
  16.         )  
  17.     }  
  18. );  
  19. SubmitForm(Form3);  
Create Repeating Section In PowerApps Edit Form
 
Now, let’s add the following variable as a default value for the Repeating section data card which we hide in the second step of this section.
 
Create Repeating Section In PowerApps Edit Form 
 
Now, let’s test the functionality!
 

Testing

  1. Navigate from the Grid.

    Create Repeating Section In PowerApps Edit Form

  2. Add a New Row.

    Create Repeating Section In PowerApps Edit Form

  3. Click on Save button.
  4. The row has been saved.

Conclusion

 
This is how we can retrieve values of the repeating section in the PowerApps Edit Form. I hope you love this article. Stay connected with me for more amazing articles!
 
Happy PowerApping!!


Similar Articles