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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Filter in API

(1) ShareShare
ReportReport
Posted on by 163
Hi All,

I am using On-Prem Business Central.

I have created one API where i want to use 2 filter, record should be fetch if anyone of the filter value match.
Example Item No or Item Name - if anyone is match record should be fetch.
 
https://xyz.com:1234/testUAT/ODataV4/Company('abc)/GetItemDetailById?$filter = ItemNo eq '10010500001'
 
Does anyone have any idea about this. Please help me on this.

Thanks for your help.
I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,801 Super User 2026 Season 1 on at
    Hi,
     
    You must use OR in your filter.
    for e.g.
    https://xyz.com:1234/testUAT/ODataV4/Company('abc')/GetItemDetailById?$filter = ItemNo eq '10010500001' or ItemName eq 'Name'
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    YUN ZHU Profile Picture
    99,084 Super User 2026 Season 1 on at
    Hi, You use OData, which is described in detail in the following MS Learn.
    Definition Example and explanation Equivalent AL expression
    Select a range of values $filter=Entry_No gt 610 and Entry_No lt 615

    Query on GLEntry service. Returns entry numbers 611 through 614.
    ..
    In a list of values $filter=EntryNo in (610, 612, 614)

    Query that returns entry numbers 610, 612, and 614

    Note: This only works in $schemaversion=2.1.
     
    And $filter=Country_Region_Code eq 'ES' and Payment_Terms_Code eq '14 DAYS'

    Query on Customer service. Returns customers in Spain where Payment_Terms_Code=14 DAYS.
    &
    Or $filter= Country_Region_Code eq 'ES' or Country_Region_Code eq 'US'

    Query on Customer service. Returns customers in Spain and the United States.

    Alert: You can use OR operators to apply different filters on the same field. However, you can't use OR operators to apply filters on two different fields.
    |
    Less than $filter=Entry_No lt 610

    Query on GLEntry service. Returns entry numbers that are less than 610.
    <
    Greater than $filter= Entry_No gt 610

    Query on GLEntry service. Returns entry numbers 611 and higher.
    >
    Greater than or equal to $filter=Entry_No ge 610

    Query on GLEntry service. Returns entry numbers 610 and higher.
    >=
    Less than or equal to $filter=Entry_No le 610

    Query on GLEntry service. Returns entry numbers up to and including 610.
    <=
    Different from (not equal) $filter=VAT_Bus_Posting_Group ne 'EXPORT'

    Query on Customer service. Returns all customers with VAT_Bus_Posting_Group not equal to EXPORT.
    <>
    endswith $filter=endswith(VAT_Bus_Posting_Group,'RT')

    Query on Customer service. Returns all customers with VAT_Bus_Posting_Group values that end in 'RT'.
    *
    startswith $filter=startswith(Name, 'S')

    Query on Customer service. Returns all customers names beginning with 'S'.
    *
    contains $filter=contains(Name, 'urn')

    Query on Customer service. Returns customer records for customers with names containing the string “urn”.
     
    substring $filter=substring(Location_Code, 5) eq 'RED'

    Query on Customer service. Returns true for customers with the string RED in their location code starting as position 5.
     
    tolower $filter=tolower(Location_Code) eq 'code red'  
    toupper $filter=toupper(FText) eq '2ND ROW'
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,128 Super User 2026 Season 1 on at
    To achieve filtering in your API request so that records are fetched if either the Item No or Item Name matches, you can use the $filter query option with the or operator in your OData query.
     
    https://xyz.com:1234/testUAT/ODataV4/Company('abc')/GetItemDetailById?$filter=ItemNo eq '10010500001' or ItemName eq 'YourItemName'
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,946 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,177 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 555 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans