cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jd71
New Member

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
New Member

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,504)