cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DiscoStu1985
Frequent Visitor

Merge two collections without unique key

Hi all,

 

is it possible to merge two collections (without unique key) in Power Apps like following example I have created in MS Access (pls see attached screenshot)?

 

The idea is to have a new collection with all possible combinations of products and activities.

 

Thank you for feedback and support!

Malte

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @v-siky-msft / Hi @timl 

 

thank you both for your quick responses.

 

I have tried the solution of  @v-siky-msft and the code works perfectly.

ForAll(tbl_Product, ForAll(tbl_Activity, Collect(MyCol, {Product: tbl_Product[@Product],Activity: tbl_Activity[@Activity})))

 

Only a "]" after "[@Activtiy" was missing 😉

 

ForAll(tbl_Product, ForAll(tbl_Activity, Collect(MyCol, {Product: tbl_Product[@Product],Activity: tbl_Activity[@Activity]})))

 

 

 

Thank you and all the best,

Malte

View solution in original post

3 REPLIES 3
v-siky-msft
Community Support
Community Support

Hi @DiscoStu1985 ,

 

Could you please try this?

Put the code to Button OnSelect to trigger manually or OnStart of App. The Collection MyCol is what you want.

ForAll(tbl_Product, ForAll(tbl_Activity, Collect(MyCol, {Product: tbl_Product[@Product],Activity: tbl_Activity[@Activity})))

 Hope this helps.

Sik

Hi @DiscoStu1985 

Here's a post that I made about how to do this without using ForAll. Perhaps that might help you.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Adding-rows-from-one-table-to-another/m-p/50... 

Hi @v-siky-msft / Hi @timl 

 

thank you both for your quick responses.

 

I have tried the solution of  @v-siky-msft and the code works perfectly.

ForAll(tbl_Product, ForAll(tbl_Activity, Collect(MyCol, {Product: tbl_Product[@Product],Activity: tbl_Activity[@Activity})))

 

Only a "]" after "[@Activtiy" was missing 😉

 

ForAll(tbl_Product, ForAll(tbl_Activity, Collect(MyCol, {Product: tbl_Product[@Product],Activity: tbl_Activity[@Activity]})))

 

 

 

Thank you and all the best,

Malte

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (40,943)