Skip to main content

Notifications

Power Apps - Microsoft Dataverse
Answered

Cannot compare a guid value with a collection of records

(1) ShareShare
ReportReport
Posted on by

Hi, 

i'm facing a problem. 

i've made a collection named "colOwnersByPrd" that store the Owner value of record selected in a combobox. 

 

I have a button "Search" and when i click on it, it supposed to filter a gallery that contain users from the systemuser entity. To do that, i'm trying to show only users where the guid is in the collection "colOwnersByPrd". 

 

The problem is "colOwnersByPrd" result is a record type and the criteria of my filter doesn't match between guid and record type. 

 

Here's the collection "colOwnersByPrd" definition : 

jd71_1-1640199985011.png

 

Here's the filter code : 

jd71_0-1640199809601.png

 

The message is "Cannot convert this Guid to Record". 

Utilisateur is the keyprimary of the Systemuser entity. 

 

How can i retrieve systemusers where the guid is IN my collection "colOwnersByPrd" ?

 

Many thanks for your help.

 

 

  • jd71 Profile Picture
    jd71 on at
    Re: Cannot compare a guid value with a collection of records

    I all. 

    Thanks for helping me. 

    Yesterday, i've finally resolved the problem by replacing "Utilisateur propriétaire" with "Utilisateur propriétaire".Utilisateur in the distinct criteria. 

     

     

  • Re: Cannot compare a guid value with a collection of records

    Hi @jd71 ,

     

    Is the column in the red frame of the image the owner column?

    vxiaochenmsft_0-1640228168480.png

     

    If so, I assume the owner of your items are all users not teams and I did a test for you.

     

    Add a button control and set its onselect property to:

     

    ClearCollect(Col,ForAll(Distinct('TestL 17S',Owner),AsType(ThisRecord.Result,Users)))

     

    // You can modify your formula according to my sample.

     

    Now the specific user records in the user table is already in your collection.

    You could use gallery or something other controls to get the values in this collction.

    vxiaochenmsft_1-1640228617302.png

    vxiaochenmsft_2-1640228624700.png

     

    It should be noted that if you check the collection directly, you will find that it is all blank, but this does not affect to use it.

    vxiaochenmsft_3-1640228701137.png

     

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-astype-istype 

     

    Best Regards,

    Wearsky

     

     

     

  • Verified answer
    dave-jorgensen Profile Picture
    dave-jorgensen 502 on at
    Re: Cannot compare a guid value with a collection of records

    Note the error message gives a good indication. 

    How can i retrieve systemusers where the guid is IN my collection "colOwnersByPrd" - the answer is, you need to filter your collection where a FIELD in that collection has the guid value. Your code is saying "get me the records where this guid is in the RECORD". colOwnersByPrd.Result is a table of Records (users), so you should change your distinct to get you the distinct GUIDS where as right now you are getting the distinct USERS.

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard

Featured topics