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 / Create a collection fr...
Power Apps
Unanswered

Create a collection from multiple collections

(0) ShareShare
ReportReport
Posted on by 364

Hi all, 

 

Like my subject line says, I am wondering how I can create a collection that combines data from multiple collections. In an app I have, there are 5 different collections that do different things. Each collection does record a "Part #" amongst other things, and I would like to create a collection that grabs the "Part #" from each of these collections. 

 

My collections are "colConnectors", "colAccessories", "colSeals", and "colTerminals" 

 

I am imagining using ClearCollect on a button's OnSelect property to create this collection of collections. I had tried to do something like: 

ClearCollect(colAllParts, {'Part #': ForAll(colConnectors, PartNumber) || ForAll(colTerminal, EndTerminal))

 

But is obviously not working. Can anyone help point me in the right direction for generating this list?

Categories:
I have the same question (0)
  • subsguts Profile Picture
    1,259 Moderator on at
  • AaronKnox Profile Picture
    514 Super User 2024 Season 1 on at

    One approach is to group the *PartNumber column: 

     

    ClearCollect(colAllParts, colConnectors,colAccessories,colSeals,colTerminals); 
    ClearCollect(colAllPartsGrouped, GroupBy(colAllParts, "PartNumber", "_groupedRecords"))

     

     

    This gives you a tidy list of unique PartNumbers and a table of all records for each PartNumber:

    CaptureB.PNG

     

    Then if you want to fetch all records for example, for PartNumber 1AA, you simply have to LookUp that part number from the collection:

     

    LookUp(colAllPartsGrouped, PartNumber="1AA")._groupedRecords

     

    This screenshot is an example for a DataTable:

    CaptureC.PNG

     

    * This assumes all collections have identical column names for PartNumber, if not you will want to AddColumns (or RenameColumns) when building the initial collections to have this common column name. 

    For example, if a list called testList has Part_x0023_ as the column name, you can duplicate this column in a new column called "PartNumber" when collecting:

     

    ClearCollect(colExample,AddColumns(testList,"PartNumber",Part_x0023_ ) ); 

     

    CaptureD.PNG

  • Aurora Profile Picture
    364 on at

    @AaronKnox 

     

    How would I go about showing every single record in colAllPartsGrouped? 

     

    For example, part 1AA might be used for multiple connectors in my connector collection. However, when I use GroupBy I only get 1 record for each part number - even if there are multiple. I realize that the additional records are nested inside the table created when using GroupBy, but is there an easy way to show the number of times each part appears? 

     

    Your initial solution was very helpful for getting me started, I appreciate your feedback.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard