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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combining two collections
Power Apps
Unanswered

Combining two collections

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1
I want to combine two collections into one.  So n the new collection (colCombined) ,  for every entry in colA  I want a row from colB and  the fields of colB tagged on and included  so for example in colA I have 4 rows with 3 columns column1 column2 column3
and in ColB I have 2 columns and 3 rows
ColA
 
Column1A Column2A Colum3A
Blue Round Here
Red square There 
Green Triangle everywhere
Yellow Round there
 
ColB
 
Column1B Column2B
Yesterday 1
Today 2
Tomorrow 3
 
I want the new colCombined to look like this
 
ColComb1 ColComb2 ColComb3 ColComb4 ColComb5
Blue Red Here Yesterday 1
Blue Red Here Today 2
Blue Red Here Tomorrow 3
Red Square There Yesterday 1
Red Square There Today 2
Red Square There Tomorrow 3
etc etc      
 
This is the code I have and it works.. however it creates a nested collection and I have to click on each row to view the details in the collection and so therefore I can't either use it in a gallery or patch it easily to a list which is what I want to do.  How do I make the collection flat?
 
ClearCollect(
    colCombined,
    ForAll(
        colA,
        ForAll(
            colB,
            {
                
                CombinedField1:colAfield1,
                CombinedField2:colAfield2,
                CombinedField3:colAfield3
                CombinedField4:colBfield1,
                CombinedField5:colBfield2,

            }
    ))
)
 
Hoping you can help !
 
 
If it's more efficient to patch the combination of the 2 collections straight to the sharepoint list rather than this middle step of creating a collection I'm happy to do that.  There is one people field amongst the fields so that just needs to be taken into account when patching
 
Thanks
 
TIA
 
 
 
 
 
Categories:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard