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...
Answered

Understanding API Queries

(0) ShareShare
ReportReport
Posted on by

Hello

I am super confused about how to work an api query or page table. I understand how to get all of the data from my custom api page and query, but I am trying to have an input that will only get one row of the table. Right now, I am entering a No in the header (what material I want the information for). The code is below

pastedimage1655323281439v2.png

What do I need to do to filter this so I only get a specific input that is specified in the header???

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,634 Super User 2025 Season 2 on at

    Hi, If you want to filter the query results directly, you can use the DataItemTableFilter Property.

    More details: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-dataitemtablefilter-property

    For example:

    pastedimage1655339314009v1.png

    Hope this helps.

    Thanks.

    ZHU

  • Community Member Profile Picture
    on at

    That is extremely helpful! Do you know where the inputs go when calling a query? Like if I want to filter based on a variable that is being passed in the header? (ex. a specific item that is subject to change between calls)

  • Verified answer
    YUN ZHU Profile Picture
    95,634 Super User 2025 Season 2 on at

    Hi, If you read Query data in AL, you can use the following method to filter.

    Query.SetFilter(Any, Text [, Any,...]) Method: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/query/queryinstance-setfilter-method

    Query.SetRange(Any [, Any] [, Any]) Method: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/query/queryinstance-setrange-method

    For example,

    pastedimage1655422795648v2.png

    If you're in an API, this requires the API's filter method.

    For example,

    pastedimage1655422971539v3.png

    api.businesscentral.dynamics.com/.../VendorLedgerEntries?$filter=Vendor_No eq '20000'

    pastedimage1655423050222v4.png

    More details: https://yzhums.com/6117/#toc8 (please replace the single quotation marks)

    pastedimage1655423081873v5.png

    Hope this helps.

    Thanks.

    ZHU

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 2,785

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 948 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans