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

Community site session details

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

filter by column in the table

(0) ShareShare
ReportReport
Posted on by 30

Hello,

I need to filter a column for a specific vendor when a vendor has been selected from another table.

The supplier is entered from another table "Purchase header".
How do I filter the Vendor Number column in the Purchase Line table? I tried various ways nothing helps. Code Units/extension of tables and pages_21043D0438043C043E043A04_-_4D043A04400430043D043004_-2023_2D00_05_2D00_10-_3204_-16.16.49.png

I have the same question (0)
  • elhola Profile Picture
    30 on at
    RE: filter by column in the table

    I figured it out. you need to set a filter in the table extension

    trigger OnValidate()
    begin
    SETFILTER("Vendor No.", "Buy-from Vendor No.");
    end;

  • Suggested answer
    Govinda Kumar Profile Picture
    2,304 Moderator on at
    RE: filter by column in the table

    Hi,
    If you want to filter the Vendor column in Purchase Line table based on the selected vendor in Purchase Header table, you can use the SetFilter method in AL like this
    YourCurrentRecord.SetFilter("Vendor No.", '=%1', PurchaseHeaderTable."Buy-from Vendor No.");
    This code sets a filter on the Vendor column using = operator and vendor no. selected in Purchase Header table, you can also use SetRange and other filter methods as well.. check out this documentation for more information learn.microsoft.com/.../record-setfilter-method & learn.microsoft.com/.../record-setrange-method
    I hope this helps!
    Regards

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,602

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 3,033 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,738 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans