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.
- Navigate(EditPage,ScreenTransition.None,{SelectedItem:Gallery1.Selected})
Step 2
- Let’s create an Edit Page.
- Create a New screen and add Edit Form. Hide the repeating section.
- Add the following code in below events of the form.
Data Source
Select WO.
Item
Add “SelectedItem” which we have passed as a variable in step 1.2
Add the following code snippet in the OnVisible event of the edit form.
- UpdateContext({EditStringVal: SelectedItem.RepeatedSection});
- Clear(EditCols);
- Set(
- Editstr,
- SelectedItem.RepeatedSection
- );
- Set(
- Editstr,
- Left(
- Editstr,
- Len(Editstr) - 1
- )
- );
- ForAll(
- Split(
- Editstr,
- "|"
- ),
- Collect(
- EditCols,
- {
- CItemSerialNumber: Text(
- Last(
- FirstN(
- Split(
- Result,
- ";"
- ).Result,
- 1
- ).Result
- ).Result
- ),
- Clevel: Text(
- Last(
- FirstN(
- Split(
- Result,
- ";"
- ).Result,
- 2
- ).Result
- ).Result
- ),
- Ctc: Text(
- Last(
- FirstN(
- Split(
- Result,
- ";"
- ).Result,
- 3
- ).Result
- ).Result
- ),
- Cdescription: Text(
- Last(
- FirstN(
- Split(
- Result,
- ";"
- ).Result,
- 4
- ).Result
- ).Result
- )
- }
- )
- )
Now let’s add the Gallery control with labels, buttons, and dropdowns.
In Items > Add “EditCols” collection which we have created in the above section.
Now, let’s add the code snippet for the following sections.
New button Code
- Collect(
- EditCols,
- {
- CItemSerialNumber: Text(Last(EditCols).CItemSerialNumber + 1),
- Clevel: "",
- Ctc: "",
- Cdescription: ""
- }
- )
Close Button Code
- RemoveIf(EditCols,CItemSerialNumber = ThisItem.CItemSerialNumber)
Save button Code
- UpdateContext(
- {
- EditStringVal: Concat(
- RepeattingTable_3.AllItems,
- Concatenate(
- 'sr.no_edit'.Text,
- ";",
- drpedit.SelectedText.Value,
- ";",
- technicalcontent_edit.Text,
- ";",
- description_edit.Text,
- ";",
- "|"
- )
- )
- }
- );
- SubmitForm(Form3);
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.
Now, let’s test the functionality!
Testing
- Navigate from the Grid.
- Add a New Row.
- Click on Save button.
- 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!!