Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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:
  • Aurora Profile Picture
    364 on at
    Re: Create a collection from multiple collections

    @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.

  • AaronKnox Profile Picture
    510 Super User 2024 Season 1 on at
    Re: Create a collection from multiple collections

    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

  • subsguts Profile Picture
    1,259 Super User 2025 Season 1 on at

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard