Create Repeating Table in Canvas app

Loading

Requirement: To create Repeating table in Canvas app, Create a Collection to store the values from the repeating table and also create a SharePoint list to store the values from the repeating table.

Step 1: Create a SharePoint list which is called as Master list(Employee Details), in that add Columns shown below:

EmployeeID: Number column
EmployeeName: Single line of text
EmployeeAddress: Multiline of text
ExperienceInMonths: Number column
Master list

Step 2: Create another SharePoint list( Experience Levels), which is used store the values from the Repeating table.

Where the ID should be same for both the lists, so used lookup column for EmployeeID from Master list to Experience Levels list.

Experience Levels

Step 3:Now Go to Power apps, Create Canvas app

  • Add button to create collection for Repeating table
  • Add Header to the Screen
  • Add the collection to the Screen OnVisible Property and set the ID to get from the Master list
  • Add Edit form of Data source Employee Details(Master List)
  • Add custom Datacard to the form in that custom Datacard add Gallery
  • Add TextInputs and CombBox to the gallery
1.Button- OnSelect Property:
Collect(colrepeat,{EmployeeID:"",Technology:"",ExperienceInMonths:"",Levelofknowledge:""})

2.Screen OnVisible Property- 
ClearCollect(colrepeat,{EmployeeID:"",Technology:"",ExperienceInMonths:"",Levelofknowledge:""});
Set(LastAddedItem,First(Sort('Employee Details',ID,SortOrder.Descending)))

3.+ Icon- OnSelect Property:
Collect(colrepeat,{EmployeeID:"",Technology:"",ExperienceInMonths:"",Levelofknowledge:""})

4.Form- DataSource Property: 
'Employee Details'

5."Textinput1(EmployeeID)- 
OnChange Property:Patch(colrepeat,ThisItem,{EmployeeID:txtEmployeeID.Text})
Defaults Property: DataCardValue2.Text 
"To get the LookUp value used the above formula in defaults property."

Technology ComboBox- 
OnChange Property: Patch(colrepeat,ThisItem,{Technology:cbTechnology.Selected.Value})
Items Property: Choices('Experience Levels'.Technology)

ExperienceInMonths textinput-
Onchange Property: Patch(colrepeat,ThisItem,{ExperienceInMonths:txtExperienceInMonths.Text})
Default Property: ThisItem.ExperienceInMonths

Levelofknowledge comboBox-
OnChange Property:Patch(colrepeat,ThisItem,{Levelofknowledge:cbLevelOfKnowledge.Selected.Value})
Items Property:Choices('Experience Levels'.Levelofknowledge)"

Step 4: Add Trash Icon to remove data from collection if required, add the below function to the icon on OnSelect Property:

Remove(colrepeat,ThisItem)

Step 5: Add a Button to Patch the collection to SharePoint list

OnSelect Property:
ForAll(
    colrepeat,
    Patch(
        'Experience Levels',
        Defaults('Experience Levels'),
        {
            'Employee ID': {
                Id: LastAddedItem.ID,
                Value: Value(LastAddedItem.ID)
            },
            Technology: {Value: Technology},
            ExperienceInMonths: Value(ExperienceInMonths),
            'Level of knowledge': {Value: Levelofknowledge}
        }
    )
);
SubmitForm(Form1);
Clear(colrepeat);

Step 6: After this Save and Publish the Application and Preview

Leave a Reply

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