web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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.
I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,997 Super User 2025 Season 2 on at
    If plan A doesn't work then go for plan B
    ?$filter=code eq '10' OR code eq '20'
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,390 Super User 2025 Season 2 on at
    Hi,
     
    try without quotation mark.
    dimensionValues?$filter=code in (10, 20)
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,284 Super User 2025 Season 2 on at
  • Suggested answer
    YUN ZHU Profile Picture
    95,432 Super User 2025 Season 2 on at
    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
  • PK-20051639-0 Profile Picture
    11 on at
    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.
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,064

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,568 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,063 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans