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
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,033)