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

Populate Filter based on selected Filter

(0) ShareShare
ReportReport
Posted on by 55

Hi,

I'm trying to populate a filtered list on a report based on the value that is selected on another filter that was selected:

pastedimage1664533425050v1.png



pastedimage1664533827018v2.png



First I'm getting the Sales Order Numbers and Lot Numbers populated with custom filters.

If I 'hard code' then I can get the lot numbers populate but the selection is not working as the lot number is a Primary key on the Lot table

  trigger OnPreDataItem()
                    begin
                        SetRange("Source No. 3", LotNumberFilter);
                    end;
 trigger OnPreDataItem()
            begin
                SetRange("No.", SoNumberFilter);
            end;



1) How can I get the value  from the filter that is selected on the Sales Order Number
2) How can I create a 'lookup' or table relation so that the Lot Numbers will only populate according to the value that was selected on the first filter

                }


group(General)
                {
                    field(SoNumberFilter; SoNumberFilter)
                    {
                        TableRelation = "Sales Line"."Document No.";
                        ApplicationArea = All;
                        Caption = 'Please filter on a Sales Order Number: ';
                    }
                    field(LotNumberFilter; LotNumberFilter)
                    {
                        //TableRelation = "Lot No. Information"."Lot No.";
                        TableRelation = "Sales Line"."No." WHERE("Document No." = const('SO10190'));
                        ApplicationArea = All;
                        Caption = 'Please filter on a Lot Number: ';
                    }




  • Verified answer
    Amit Baru Profile Picture
    3,029 on at
    RE: Populate Filter based on selected Filter

    Hi,

    Create button on Sales Line page

    setrange("Document No.",DocumentNo);

    Report.run(True,False,Rec);

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,025 Moderator on at
    RE: Populate Filter based on selected Filter

    Because you are only submitting part of your code, it is a bit hard to see what you really are trying to do here.

    But it can look like you try to have a page with a page part.

    In order to achieve that you need to use a sub page link as described here:

    learn.microsoft.com/.../devenv-subpagelink-property

    Or is it only the lot numbers in your request page that should be filtered by sales order no?

    These cases are easier solved if you share the complete code instead of just screen shots of it. f you use rich formatting when writing your post you can insert code.

  • Suggested answer
    Andy Sather Profile Picture
    on at
    RE: Populate Filter based on selected Filter

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 290 Super User 2025 Season 1

#2
Mansi Soni Profile Picture

Mansi Soni 196

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 156 Most Valuable Professional

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans