cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CShaneGoodman
Helper I
Helper I

How do I filter a Choice column?

Greetings,

 

I have created a Dataverse table. There is a Choice column called Country which can be either Canada or the United States. I would like to use the Web API to show only records for Canada.

 

The documentation says to use this function:

 

GET /api/data/v9.2/cr4fc_schools?$filter=Microsoft.Dynamics.CRM.ContainValues(PropertyName='cr4fc_country',PropertyValues=['197880000']) HTTP/1.1

 

However, I'm getting an error which says:

 

"code": "0x80048415",
"message": "Condition Operator picklist not valid for attribute type"
 

I thought that the error meant that the value for Canada (197880000) was wrong, but this value is in fact correct. Does anyone know what this error message means?

 

Thanks,

Shane.

1 ACCEPTED SOLUTION

Accepted Solutions
rampprakash
Super User
Super User

Hello @CShaneGoodman,

 

Hope you are doing good, You can try below code

 

/api/data/v9.1/cr4fc_schools?$filter=cr4fc_country eq '197880000'

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

View solution in original post

2 REPLIES 2
rampprakash
Super User
Super User

Hello @CShaneGoodman,

 

Hope you are doing good, You can try below code

 

/api/data/v9.1/cr4fc_schools?$filter=cr4fc_country eq '197880000'

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

CShaneGoodman
Helper I
Helper I

A URI can't handle spaces, so I had to encode them. The value is a number, so I had to remove the quotes. The end part now looks like this:

 

?$filter=cr4fc_country+eq+197880000
 
This worked. Thanks for your help.
Shane.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,498)