web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Parent/child list in a...
Power Apps
Answered

Parent/child list in a Power App: How to implement a button that adds a row and moves/resizes the form.

(0) ShareShare
ReportReport
Posted on by

Let's say I have two lists:

-Projects

-Project Employees.

 

In the Projects list, I have the following columns: UID, Name, Project Number;

In the Project Employees I have the following columns: UID, Project_UID, Employee Name, Start Date, End Date.

 - UID - is the primary list unique ID.

- Project_UID is a look up field for the "Projects" list UID field. It's set up as an index with cascade delete.

 

Now, I'm trying to understand what would be the controls that would allow me to create an "Add" button that would continuously add a new "row/section" for me to type the new employee details (child) for this list. When clicking on the add button, the form/card should extend or create a new employee section to allow adding as many employee rows I would like.

 

Check out this video at 7:11 mark to understand what I mean: https://youtu.be/AdAGFR3UIW8?t=431

 

Can this be achieved with a gallery?

 

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @Anonymous ,

    Do you want to add new records to your Project Employees list continuously through the "Add" button?

     

    Based on the needs that you mentioned, I think the Gallery control could achieve your needs. Please check and see if the following video resources could help in your scenario:

    https://www.youtube.com/watch?v=xgznk4XlPCo

    https://www.youtube.com/watch?v=DylxsXIUyDc

    https://www.youtube.com/watch?v=vjfrXUa1Juw

     

    I have made a test on my side, please consider take a try with the following workaround:

    1.JPG2.JPG3.JPG4.JPG5.JPG

    Set the OnStart property of App to following:

    ClearCollect(GalleryCollection, CountRows(GalleryCollection)+1)

    Add a "+" icon in your screen, set the OnSelect property to following:

    Collect(GalleryCollection, CountRows(GalleryCollection)+1)

    Add a Gallery, set the Items property to following:

    GalleryCollection

    within the Gallery, add a Text Input, a ComboBox, two Date Pickers and a "Save" icon. And outside the Gallery, add several Labels above the Gallery to act as column headers.

     

    Set the Items property of the Project_UID ComboBox within the Gallery to following:

    Choices('Project Employees'.Project_UID)

    set the SelectMultiple property of this ComboBox to false.

     

    Set the OnSelect property of the "Save" Icon within the Gallery to following:

    Patch(
     'Project Employees', 
     Defaults('Project Employees'),
     {
     Title: "Entry Record",
     'Employee Name': EmployeeNameTex.Text,
     Project_UID: ProjectUIDComboBox.Selected,
     'Start Date': StartDatePicker.SelectedDate,
     'End Date': EndDatePicker.SelectedDate
     }
    )

     

    Set the OnSelect property of the "Patch All" button to following:

    ForAll(
     Gallery1.AllItems, 
     Patch(
     'Project Employees', 
     Defaults('Project Employees'),
     {
     Title: "Entry Record",
     'Employee Name': EmployeeNameTex.Text,
     Project_UID: ProjectUIDComboBox.Selected,
     'Start Date': StartDatePicker.SelectedDate,
     'End Date': EndDatePicker.SelectedDate
     }
    )
    )

    Please take a try with above solution, check if the issue is solved.

     

    Patch function, ForAll function

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    Thank you for this very detailed response!

     

    I just have one more thing that I need to wrap my head around:

    For the master list (Project List), I still want to browse directly in Sharepoint. I'm using the Power app only as the view, edit form. Just like in the old sharepoint were the form is the infopath but the viewing aspect is just a sharepoint list.

     

    Now, how do I make the default sharepoint "double click on an item" action to ope the record in power apps form with a collection ready,etc.? Or the "New" button in the sharepoint list?

    I can't just add this to the screen OnLoad funtion because the logic is different depending on if the record is new or in edit mode.

     

    It sounds like this solution would only work if you go Full Power Apps and don't use the SharePoint interface at all.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard