cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jd71
Regular Visitor

Cannot compare a guid value with a collection of records

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
dave-jorgensen
Advocate V
Advocate V

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.

View solution in original post

3 REPLIES 3
dave-jorgensen
Advocate V
Advocate V

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.

v-xiaochen-msft
Community Support
Community Support

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

 

 

 

jd71
Regular Visitor

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. 

 

 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,788)