cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PytByt
Level 8

How to merge multiple collection into 1 single collection (with new column in it)

Hi all.. 

I already search the forum, but i haven't found similiar with my case here, 
I want to merge more than 5 collection into 1 single collection, but i dont understand how to do it right.

 

long story short, here is the code i use to gather my collection:

ClearCollect(
Iter1,
["A", "B", "C", "D", "E"]
);

ClearCollect(
Iter2,
["F", "G", "H", "I", "J"]
);

ClearCollect(
Iter3,
["K", "L", "M", "N", "O"]
);

ClearCollect(
Iter4,
["P", "Q", "R", "S", "T"]
);

ClearCollect(
Iter5,
["U", "V", "W", "X", "Y", "Z"]
);

ClearCollect(
Iter6,
["0", "1", "2", "3", "4"]
);

ClearCollect(
Iter7,
["5", "6", "7", "8", "9"]
);


ForAll(Iter1, Collect(BatchColl1, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));
ForAll(Iter2, Collect(BatchColl2, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));
ForAll(Iter3, Collect(BatchColl3, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));
ForAll(Iter4, Collect(BatchColl4, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));
ForAll(Iter5, Collect(BatchColl5, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));
ForAll(Iter6, Collect(BatchColl6, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));
ForAll(Iter7, Collect(BatchColl7, ShowColumns(Filter(ItemBatches,StartsWith(BatchNumber, Value)),"ItemNumber", "BatchNumber", "BatchExpirationDate")));

I also tried this formula, but it doesn't work:
Collect(ReleasedProductsColl, ShowColumns(Filter(ReleasedProductsV2, ProductGroupId = "10" && ProductGroupId = "20" && ProductGroupId = "40"), "ProductGroupId", "ItemNumber", "SearchName"))

Is my formula right?
if not, what is the simpliest way to achieve it?

And how i can merge all that BatchColl 1 through 7 together into 1 Collection only?

Please help.

 

BR.

pytbyt

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to merge multiple collection into 1 single collection (with new column in it)

Hi @PytByt ,

Could you please share a bit more about the target collection data structure you want to achieve?

Do you want to merge your BatchColl collection 1 through 7 into single one collection?

 

Based on the formula you provided to gather your BatchColl collection, I think it is right. If you want to achieve same functionality using easier way, please consider take a try with the following formula:

Concurrent(
             ClearCollect(Iter1, ["A", "B", "C", "D", "E"]),
             ClearCollect(Iter2, ["F", "G", "H", "I", "J"]),
ClearCollect(Iter3, ["K", "L", "M", "N", "O"]), ClearCollect(Iter4, ["P", "Q", "R", "S", "T"]), ClearCollect(Iter5, ["U", "V", "W", "X", "Y", "Z"]),
ClearCollect(Iter6, ["0", "1", "2", "3", "4"]), ClearCollect(Iter7, ["5", "6", "7", "8", "9"]) );
Collect(BatchColl1, ShowColumns(Filter(ItemBatches, BatchNumber in Iter1), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl2, ShowColumns(Filter(ItemBatches, BatchNumber in Iter2), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl3, ShowColumns(Filter(ItemBatches, BatchNumber in Iter3), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl4, ShowColumns(Filter(ItemBatches, BatchNumber in Iter4), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl5, ShowColumns(Filter(ItemBatches, BatchNumber in Iter5), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl6, ShowColumns(Filter(ItemBatches, BatchNumber in Iter6), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl7, ShowColumns(Filter(ItemBatches, BatchNumber in Iter7), "ItemNumber", "BatchNumber", "BatchExpirationDate"));

In addition, if you want to merge the BatchColl collection 1 through 7 into single one collection, please take a try with the following formula:

ClearCollect(MergedCollection, BatchColl1, BatchColl2, BatchColl3, BatchColl4, BatchColl5, BatchColl6, BatchColl7)

then you could use the MergedCollection as data source in your app.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: How to merge multiple collection into 1 single collection (with new column in it)

Hi @PytByt ,

Could you please share a bit more about the target collection data structure you want to achieve?

Do you want to merge your BatchColl collection 1 through 7 into single one collection?

 

Based on the formula you provided to gather your BatchColl collection, I think it is right. If you want to achieve same functionality using easier way, please consider take a try with the following formula:

Concurrent(
             ClearCollect(Iter1, ["A", "B", "C", "D", "E"]),
             ClearCollect(Iter2, ["F", "G", "H", "I", "J"]),
ClearCollect(Iter3, ["K", "L", "M", "N", "O"]), ClearCollect(Iter4, ["P", "Q", "R", "S", "T"]), ClearCollect(Iter5, ["U", "V", "W", "X", "Y", "Z"]),
ClearCollect(Iter6, ["0", "1", "2", "3", "4"]), ClearCollect(Iter7, ["5", "6", "7", "8", "9"]) );
Collect(BatchColl1, ShowColumns(Filter(ItemBatches, BatchNumber in Iter1), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl2, ShowColumns(Filter(ItemBatches, BatchNumber in Iter2), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl3, ShowColumns(Filter(ItemBatches, BatchNumber in Iter3), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl4, ShowColumns(Filter(ItemBatches, BatchNumber in Iter4), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl5, ShowColumns(Filter(ItemBatches, BatchNumber in Iter5), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl6, ShowColumns(Filter(ItemBatches, BatchNumber in Iter6), "ItemNumber", "BatchNumber", "BatchExpirationDate"));
Collect(BatchColl7, ShowColumns(Filter(ItemBatches, BatchNumber in Iter7), "ItemNumber", "BatchNumber", "BatchExpirationDate"));

In addition, if you want to merge the BatchColl collection 1 through 7 into single one collection, please take a try with the following formula:

ClearCollect(MergedCollection, BatchColl1, BatchColl2, BatchColl3, BatchColl4, BatchColl5, BatchColl6, BatchColl7)

then you could use the MergedCollection as data source in your app.

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

PytByt
Level 8

Re: How to merge multiple collection into 1 single collection (with new column in it)

hello @v-xida-msft 

thank you for your reply and solution.

glad to have this community alive.

 

if my formula is already correct, then all i need to do is to merge the BatchColl collection 1 through 7 into single one collection.

 

thank you.

 

regards,

pytbyt

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,356)