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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combining two collecti...
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.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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.

  • nagestiada Profile Picture
    504 on at

    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,297 Super User 2024 Season 1 on at

    @nagestiada 

    What kind of column is Product?

  • nagestiada Profile Picture
    504 on at

    @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,297 Super User 2024 Season 1 on at

    @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

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

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @nagestiada 

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

  • nagestiada Profile Picture
    504 on at

     

    @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,297 Super User 2024 Season 1 on at

    @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).

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard