Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

The in expression in the $filter does not have any impact on the result

(1) ShareShare
ReportReport
Posted on by 11
Hi All, we are trying to use in operator to match multiple values. We are getting all the records in the response and it seems the in expression does not have any impact on the response. 
 
We were testing using following API :

{BCPrefix}/Dev/api/v2.0/companies(<companyid>)/dimensionValues it gives us following
 
[{
/@odata.etag/: /W////JzE5OzIyNjMyMTYzMTc1MjYyNDczNDExOzAwOyc=////,
/id/: /8aae50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/code/: /10/,
/dimensionId/: /3eab50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/displayName/: /Europe/,
/consolidationCode/: //,
/lastModifiedDateTime/: /2023-11-29T09:51:02.533Z/
},
{
/@odata.etag/: /W////JzIwOzEzMjM3MDMxMTk5NDUyOTAzMTgxMTswMDsn////,
/id/: /8bae50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/code/: /20/,
/dimensionId/: /3eab50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/displayName/: /Europe North/,
/consolidationCode/: //,
/lastModifiedDateTime/: /2023-11-29T09:51:02.543Z/
},
{
/@odata.etag/: /W////JzIwOzE1MTMyNjk2NTYzNDI3NTI1OTI0MTswMDsn////,
/id/: /8cae50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/code/: /30/,
/dimensionId/: /3eab50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/displayName/: /Europe North (EU)/,
/consolidationCode/: //,
/lastModifiedDateTime/: /2023-11-29T09:51:02.55Z/
}
]


When we add the filter, 
{BCPrefix}/Dev/api/v2.0/companies(<companyid>)/dimensionValues?$filter=code in ('10', '20')

[
{
/@odata.etag/: /W////JzE5OzIyNjMyMTYzMTc1MjYyNDczNDExOzAwOyc=////,
/id/: /8aae50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/code/: /10/,
/dimensionId/: /3eab50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/displayName/: /Europe/,
/consolidationCode/: //,
/lastModifiedDateTime/: /2023-11-29T09:51:02.533Z/
},
{
/@odata.etag/: /W////JzIwOzEzMjM3MDMxMTk5NDUyOTAzMTgxMTswMDsn////,
/id/: /8bae50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/code/: /20/,
/dimensionId/: /3eab50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/displayName/: /Europe North/,
/consolidationCode/: //,
/lastModifiedDateTime/: /2023-11-29T09:51:02.543Z/
},
{
/@odata.etag/: /W////JzIwOzE1MTMyNjk2NTYzNDI3NTI1OTI0MTswMDsn////,
/id/: /8cae50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/code/: /30/,
/dimensionId/: /3eab50b4-9c8e-ee11-be3f-6045bde9b4bf/,
/displayName/: /Europe North (EU)/,
/consolidationCode/: //,
/lastModifiedDateTime/: /2023-11-29T09:51:02.55Z/
}]

Still we are getting the 3rd record which has code value 30. We expected that this record will not be there in the response.
  • PK-20051639-0 Profile Picture
    11 on at
    The in expression in the $filter does not have any impact on the result
    thanks a lot for suggesting the solution. 

    YUN ZHU we are using standard v2.0 rest apis https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/ and those are not supporting it somehow.
     
    TeddyH  Mohana Yadav  The use case of us could be something like, first we want to fetch 100 sales invoices. From those 100 sales invoices, we need to get the list of ids and make another call to find all the customer ledger entries where the document no. are in the list passed. This is just an example but in general we want to use this approach to get parent + linked records. So creating the 100 or conditions might not be correct.
     
    Mohamed Amine Mahmoudi   Since the $filter is passed as a param, it has to be prefixed with ?. I tried removing it but getting either 404 or some other http error code.
     
     
    Thanks again. Your help is appreciated.
     
     
  • Suggested answer
    YUN ZHU Profile Picture
    84,479 Super User 2025 Season 1 on at
    The in expression in the $filter does not have any impact on the result
    Hi, OData V4 IN operator is supported starting from BC24.
    More details:
    Use the OData V4 IN operator in web service queries
     
    Using filter expressions in OData URIs
     
    But according to my testing, this returns all records in BC24.0. I submitted the question to BC Yammer but haven't received a reply yet.
     
     
    Thanks.
    ZHU
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    13,699 Moderator on at
    The in expression in the $filter does not have any impact on the result
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    23,882 Super User 2025 Season 1 on at
    The in expression in the $filter does not have any impact on the result
    Hi,
     
    try without quotation mark.
    dimensionValues?$filter=code in (10, 20)
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Mohana Yadav Profile Picture
    60,234 Super User 2025 Season 1 on at
    The in expression in the $filter does not have any impact on the result
    If plan A doesn't work then go for plan B
    ?$filter=code eq '10' OR code eq '20'

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans