Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Combining two collection into one with both record data type

(0) ShareShare
ReportReport
Posted on by 504
ClearCollect(
 colCombine2d,
 colDIDList,
 Filter(colDIDRecommend, !(colDIDRecommend.Product in colDIDList.Product))
)

Hey guys, I am getting an error with the Product as both product are record column type.

The error says: 

 

Cant convert this data type. Power Apps can't convert this Table to a Record.

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on at
    Re: Combining two collection into one with both record data type

    @nagestiada 

    Okay, if there is no concern over the "winning" column value (meaning you are assuming that both tables would have the same product in them), then the following formula can be used:

    ForAll(
     GroupBy(
     AddColumns(
     Ungroup(Table({{tableObject: colDIDRecommend}, {tableObject: colDIDList}), "tableObject"),
     "Products",Product.Value
     ), "Products","Grp"
     ) Ass _item,
     Patch(_item, First(Grp))
    )

     

    This will give you a Distinct list with all the columns from the record as well (the first one - again, the assumption is they are all the same).

  • nagestiada Profile Picture
    504 on at
    Re: Combining two collection into one with both record data type

     

    @RandyHayes 

     

    colDIDRecommend

    ProductNameProduct
    New ProductGLA
    New ProductTPA

     

    colDIDList

    ProductNameProduct
    Current Year ProductGLA
    Current Year ProductIRA

     

    Gallery (OUTPUT)

    ProductNameProduct
    Current Year ProductGLA
    Current Year ProductIRA
    New ProductTPA

     

    So it's like merging two collection into 1 gallery and the product and productname are both record (choice column from sharepoint list)

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on at
    Re: Combining two collection into one with both record data type

    @nagestiada 

    Okay, so then why are your grouping the table??

  • nagestiada Profile Picture
    504 on at
    Re: Combining two collection into one with both record data type

    @RandyHayes, It's working properly, however I want to get the ProductName that is outside the GroupBy.

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on at
    Re: Combining two collection into one with both record data type

    @nagestiada 

    Yes, I would recommend this without a bunch of duplicated collections anyway - so, a better approach.

    Is it working as you need now or is there still an issue?

  • nagestiada Profile Picture
    504 on at
    Re: Combining two collection into one with both record data type

    @RandyHayes  The Product is record column type on both collection.

     

    If not possible, I tried a new solution where  I grouped the Product, the code below does the job however, I want to add and show more fields that are not grouped by Like the Product Name which is the same column name on both collection but has different values so I will just show it

    With(
     {
     outputTable: Ungroup(
     Table(/* Create the table with child tables. If you want to join more tables, add more items to this table and the formula will work the same way*/
     {tableObject: colDIDRecommend},
     {tableObject: colDIDList}
     ),
     "tableObject"
     )/* Merges all the tables into a single one, but no duplicates removed */
     },
     ShowColumns(
     GroupBy(AddColumns(outputTable, "Products",Product.Value),"Products","Grp"),
     "Products")
     
    )

     The addcolumns is inside the groupby to solve the record issue

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on at
    Re: Combining two collection into one with both record data type

    @nagestiada 

    What kind of column is Product?

  • nagestiada Profile Picture
    504 on at
    Re: Combining two collection into one with both record data type

    Hello @RandyHayes,

     

    I am now getting this error

    Invalid argument Type. Expecting a Record value, but of a different schema.

    Missing column. Your formula is missing a column 'Product' with a type of 'Record.

     

     

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on at
    Re: Combining two collection into one with both record data type

    @nagestiada 
    Yes, because you are comparing records...you can't compare records in PowerApps.

     

    Please consider changing your Formula to the following:

    ClearCollect(
     colCombine2d,
     colDIDList,
     Filter(colDIDRecommend, 
     !(Product in colDIDList.Product)
     )
    )

     

    I hope this is helpful for you.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1