Site icon Anj Cerbolles

Repeating Tables in Power Apps using SharePoint List Form

See Part II of my Blog here: Repeating Tables in Power Apps using SharePoint List Form 2.0.

As InfoPath is nearing retirement, a lot of migration is going on from InfoPath to Power Apps. The common question is how to address the repeating tables in Power Apps. As I’m doing the proof of concept and researching, I stumbled upon Shane Young’s video about how you will create repeating tables using the Power Apps canvas app. There are three videos in his series that you could use for your reference. I wrote this blog mainly because of references for any new projects using the repeating tables. I could still refer to Shane Young’s video when I’m going to build the repeating tables, but I don’t want to use the time to go back and forth to the video when I’m making the application.

“Repeating tables” is used for one to many relationship items when building e-forms using InfoPath. When you use Power Apps to update your SharePoint list form, one to many relationship tables is not available. So what we need to do is we are going to refer to Shane Young’s video in creating a repeating table using Power Apps.

One to Many Relationship

Requirements:

In this blog, we are going to create a simple invoice e-form. We are going to use SharePoint lists and Power Apps to modify the list form. Assuming you know how to create a list in SharePoint. We need two SharePoint lists: Master Lists & Child Lists (I used this naming convention in the list for easy understanding 😉

Create Item

From the Master’s List, we are going to customize the list form using Power Apps.

Customize Forms

Fields in Master Lists

NewForm(CreateItemForm);
ClearCollect(colInvoice,{LineItem: "",LinePrice: "", LineQty: ""});
Set(SharePointFormMode,"CreateForm");
Navigate(CreateScreen,Transition.None)

SharePointIntegration OnNew Action

txtItemNameCreate >> Default = ThisItem.LineItem

txtPriceCreate >> Default = ThisItem.LinePrice

txtQtyCreate >> Default = Thisitem.LineQty

Patch(colInvoice,ThisItem, {LineItem:txtItemNameCreate.Text,LinePrice:Value(txtPriceCreate.Text),LineQty:Value(txtQtyCreate.Text)});
Collect(colInvoice,LineItem:"",LinePrice:"",LineQty:""})

ForAll(colInvoice,If(!IsBlank(LineItem),Patch('Child Lists',Defaults('Child Lists'),{Title:CreateItemForm.LastSubmit.Title,cldItemName:LineItem,cldPrice:Value(LinePrice),cldQty:Value(LineQty)})));
ResetForm(Self);
RequestHide();

Edit Item

Filter('Child Lists', DataCardValue1.Text = Title)

The DataCardValue1.Text is from the EditItemForm >> EditTitleDataCard, which is the Title column of the Master Lists. The Title is the Child Lists Title column.

Set(SharePointFormMode,"EditForm");
EditForm(EditItemForm);
Navigate(EditScreen, ScreenTransition.None)

txtItemName >> OnChange = Patch('Child Lists',ThisItem,{cldItemName:txtItemName.Text})

txtQty >> OnChange = Patch('Child Lists',ThisItem,{cldQty:Value(txtQty.Text)})

In the Cancel icon, because if we select this icon, we are going to remove the records. We are going to put this code in the OnSelect action:

Remove('Child Lists',EditGalleryItems.Selected)

Show Item

Filter('Child Lists', Title = DataCardValue1_1.Text)

Set(SharePointFormMode,"ShowForm");ViewForm(ShowItemForm);Navigate(ShowScreen,ScreenTransition.None)

I hope this blog will help you for your future reference. 😉

See Part II of my Blog here: Repeating Tables in Power Apps using SharePoint List Form 2.0.

Reference:

Exit mobile version