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 / Create Collection from...
Power Apps
Unanswered

Create Collection from 2 Collections if multiple criteria and conditions Match then Collect in new record data of 2 collections

(0) ShareShare
ReportReport
Posted on by 14

Hi,

I need to merge 2 collections with similar data into new Collection so that I can compare in Gallery line by line and mark the differences in colors if no match between the 2 collection data.

So from my colMasterData system needs to fetch data from importedData with similar 4 column values and Collect myData record.

If no mapping is found then it should look for 3 similar column values, then 2 columns and so on. If no match then it should collect empty values for the imported data which is not a problem.

 

I tried to use ForAll condition function With, but no success and now using 2 ForAll's for each collection with conditions to collect but not getting the expected result, also not clean code.

//ClearCollect(Mergetable,"")
ClearCollect(
 varExempleREDS2,
 varExempleREDS
);
ClearCollect(
 varExempleHFImport2,
 varExempleHFImport
);
Clear(Mergetable);
ForAll(
 varExempleREDS,
 ForAll(
 varExempleHFImport,
 If(
 varExempleREDS[@CellName] = varExempleHFImport[@CellName] && varExempleREDS[@Antenna] = varExempleHFImport[@Antenna],
 Collect(
 Mergetable,
 {
 AllParam: true,
 CellREDs: varExempleREDS[@CellName],
 CellHF: varExempleHFImport[@CellName],
 AntennaHF: varExempleHFImport[@Antenna],
 AntennaREDs: varExempleREDS[@Antenna]
 }
 );
 RemoveIf(
 varExempleREDS2,
 CellName = varExempleREDS[@CellName] && Antenna = varExempleREDS[@Antenna]
 );
 RemoveIf(
 varExempleHFImport2,
 CellName = varExempleHFImport[@CellName] && Antenna = varExempleHFImport[@Antenna]
 )
 )
 )
)

This is just an example in the end I will have to collect with 4 conditions and then 3.... So the code will be not clean.

So then I do the same again but with different condition and again new collections without the records of older collections.

ForAll(
 varExempleREDS2,
 ForAll(
 varExempleHFImport2,
 If(
 varExempleREDS2[@CellName] = varExempleHFImport2[@CellName] && 
 (varExempleREDS2[@Antenna] <> varExempleHFImport2[@Antenna]),
 Collect(
 Mergetable2,

 Thanks in advance It should help many PowerApps dev if there is a way to loop through 2 collections and collect.

MergeModifyData.png
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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard