Multiple functions in a $where clause

469 views Asked by At

I am constructing a url for a CMS data query. I get the following to work just fine:

    https://data.cms.gov/resource/din4-7td8.json?$$app_token=REDACTED&$where=(starts_with(nppes_provider_zip,'63703') OR starts_with(nppes_provider_zip,'63701')) AND (hcpcs_code='31623' OR hcpcs_code='31622')

When I try to substitute calling multiple hcpcs_code values, I get a query.compiler.malformed error. The following generates the error:

    https://data.cms.gov/resource/din4-7td8.json?$$app_token=REDACTED&$where=(starts_with(nppes_provider_zip,'63703') OR starts_with(nppes_provider_zip,'63701') AND hcpcs_code in('31622','31623'))

Is it possible that I am using the in(...) function incorrectly?

1

There are 1 answers

2
chrismetcalf On

I think I may have caught you on IRC after you asked this question, but I'll answer here too.

It looks like you're using an old version of that API endpoint which doesn't support the IN(...) function. If you migrate to the new version of that dataset API you'll be able to issue your query: