Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,203 Super User 2024 Season 1 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

  • elhola Profile Picture
    elhola 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;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans