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

Report Filtering and Drill-Down Functionality in Business Central

(1) ShareShare
ReportReport
Posted on by 48

I am currently working on the "Product Label Report" (Report ID: 50208) in Microsoft Dynamics 365 Business Central and need assistance with two specific tasks:

  1. Filtering the Report Based on Selected Lot Number:
    I would like to configure the report so that it generates output only for the lot number selected in the request page. Currently, the report does not seem to filter based on the selected lot number.

  2. Adding an "OK" Option in the Drill-Down Trigger:
    I need to include an "OK" action in the drill-down trigger to confirm the user's selection. Specifically, I want to ensure that when users drill down into item ledger entries, the modal page offers an "OK" option to confirm their selection before proceeding further.

    Thank you in advance for your assistance.


     

    report 50208 "Product Label Report"
    {
        UsageCategory = ReportsAndAnalysis;
        ApplicationArea = All;
        DefaultLayout = RDLC;
        RDLCLayout = 'Layouts/ProductLabel.rdl';
     
        dataset
        {
            dataitem(PurchaseHeader; "Purchase Header")
            {
                dataitem(PurchaseLine; "Purchase Line")
                {
                    DataItemLink = "Document No." = field("No.");
     
                    column(ItemNo; "No.") { }
                    column(Description; Description) { }
                    column(BarCode; EncodedText) { }
                    column(PurchaseOrderNo; "Document No.") { }
                    dataitem(itemLed; "Item Ledger Entry")
                    {
                        DataItemLink = "Item No." = field("No.");
                        column(Lot_No_; "Lot No.") { }
     
                        trigger OnPreDataItem()
                        begin
                            itemLed.SetRange("Item No.", PurchaseLine."No.");
                        end;
                    }
     
                    trigger OnAfterGetRecord()
                    var
                        BarcodeString: Text;
                        BarcodeSymbology: Enum "Barcode Symbology";
                        BarcodeFontProvider: Interface "Barcode Font Provider";
                    begin
                        BarcodeFontProvider := Enum::"Barcode Font Provider"::IDAutomation1D;
                        BarcodeSymbology := Enum::"Barcode Symbology"::"Code39";
                        BarcodeString := "No.";
                        BarcodeFontProvider.ValidateInput(BarcodeString, BarcodeSymbology);
                        EncodedText := BarcodeFontProvider.EncodeFont(BarcodeString, BarcodeSymbology);
                    end;
                }
            }
        }
     
        requestpage
        {
            layout
            {
                area(Content)
                {
                    field(Lot_No; Lotno)
                    {
                        ApplicationArea = Basic, Suite;
                        Caption = 'Lot No';
                        trigger OnDrillDown()
                        var
                            ItemLedgerEntriesPage: Page "Item Ledger Entries";
                            ItemLedger: Record "Item Ledger Entry";
                            GlobalPurchaseLineMgmt: Codeunit "Global PurchaseLine Management";
                        begin
                            PurchLine := GlobalPurchaseLineMgmt.GetPurchaseLineRec();
                            ItemLedger.SetRange("Item No.", PurchLine."No.");
                            if ItemLedger.FindSet() then;
                            ItemLedgerEntriesPage.SetTableView(ItemLedger);
                            ItemLedgerEntriesPage.RunModal();
                        end;
                    }
                }
            }
        }
     
        var
            EncodedText: Text;
            Lotno: Text;
            PurchLine: Record "Purchase Line";
            autopack: Option Ok;
    }
I have the same question (0)
  • Jun Wang Profile Picture
    8,202 Super User 2025 Season 2 on at
    is it an out of box report? I searched it but no resulting report returned.
  • Verified answer
    Ramiz Profile Picture
    597 on at
    Hi,

    You are not filtering the Lot No. anywhere in the code. I had a same request but with serila no and heres how I did it.
     
    You need to filter the entries with the lot no that user is selecting.



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

#2
YUN ZHU Profile Picture

YUN ZHU 658 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 595

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans