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

Community site session details

Session Id : 7Pi9dWxGineStueGWlwIsH
Power Apps - Building Power Apps
Answered

parent child data using collections

Like (0) ShareShare
ReportReport
Posted on 25 Oct 2021 08:52:55 by 443

Hallo,

I have created a demo app and i am not using any forms. Just fields and i am using Collect to save the data to collections.

there is a uniqueID which is produced.

From a combo box field i want to add participants (this should be the child list).

the items of the combo box is Office365Users.SearchUser({searchTerm:personDD.SearchText,top:100})

On the OnChange property i make a Collection. Collect(colTravelParticipants, personDD.Selected);

Then i am using a button to add a column for the ParentID in order to connect the participants with the Parent record.

OnSelect: Collect(colTravelParticipantsWithID,ShowColumns(AddColumns(colTravelParticipants,"ParentID",var_uniqueID),"DisplayName","Mail","Department","ParentID")).

The problem is that every time i am creating a new record and adding participants, the Parent ID in the colTravelParticipantsWithID, gets updated (including Previous records with the previous uniqueID) so i am getting All records with the same unique ID.

 

Any ideas ?

 

  • Verified answer
    v-jefferni Profile Picture
    on 27 Oct 2021 at 08:06:09
    Re: parent child data using collections

    Hi @marial16 ,

     

    The issue is you are AddColumns and ShowColumns each time you click the button to add parentID. The two functions will loop all the source table. They should use only once to change the structure of a table.

     

    Please try below steps:

    1. OnChange of Combo box:

    ClearCollect(
     colTravelParticipants,
     personDD.Selected
    );
    Collect(
     colTravelParticipantsWithID,
     AddColumns(
     ShowColumns(
     colTravelParticipants,
     "DisplayName",
     "Mail",
     "Department"
     ),
     "ParentID",
     ""
     )
    )

     

    2. OnSelect of add ID button:

    Patch(
     colTravelParticipantsWithID,
     LookUp(
     colTravelParticipantsWithID,
     DisplayName = personDD.Selected.DisplayName
     ),
     {ParentID: var_uniqueID}
    )

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete