Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

How to pass multiple filter values to a Report Request

Posted on by 55

Hi,

I've written a page extension to add a custom report directly on the Sales Order.

pageextension 50210 APTRRC_SalesOrder extends "Sales Order"
{
    actions
    {
        addafter(AttachAsPDF)
        {
            action(APTRRC_ASNLabel)
            {
                Caption = 'Certificate Of Analysis';
                Promoted = true;
                Image = Report;
                PromotedCategory = Category11;
                ApplicationArea = All;
                trigger OnAction()
                var
                    SOLine: Record "Sales Line";
                begin
                    SOLine.Reset();
                    SOLine.SetRange("Document No.", "No.");
                    Report.Run(50001, true, true, SOLine);
                end;
            }
        }
    }
}

Report

report 50001 APTRRC_CertificateofAnalysis
{
    DefaultLayout = Word;
    WordLayout = '.\src\Business Central\src\reportLayout\Certificate of Analysis.docx';
    Caption = 'Certificate of Analysis';
    UsageCategory = Lists;
    AccessByPermission = report APTRRC_CertificateofAnalysis = X;
    ApplicationArea = All;

    dataset
    {
        dataitem(SOHeader; "Sales Header")
        {
            RequestFilterFields = "No.";
            column(Order_Date; "Order Date")
            {
                IncludeCaption = true;
            }
            column(External_Document_No_; "External Document No.")
            {
                IncludeCaption = true;
            }

            column(No_; "No.")
            {
                IncludeCaption = true;
            }

            column(Sell_to_Customer_No_; "Sell-to Customer No.")
            {
                IncludeCaption = true;
            }

            dataitem(CustomerInfo; Customer)
            {
                DataItemTableView = sorting("No.");
                DataItemLink = "No." = field("Sell-to Customer No.");

                column(Name; Name)
                {
                    IncludeCaption = true;
                }
                column(Ship_to_Code; "Ship-to Code")
                {
                    IncludeCaption = true;
                }
                column(E_Mail; "E-Mail")
                {
                    IncludeCaption = true;
                }
            }

            dataitem(SalesLines; "Sales Line")
            {
                DataItemTableView = sorting("Document No.");
                RequestFilterFields = "Document No.", "Lot No.";
                DataItemLink = "Document No." = field("No.");
                column(ItemNo_; "No.")
                {
                    IncludeCaption = true;
                }
                column(Description; Description)
                {
                    IncludeCaption = true;
                }
                column(Bin_Code; "Bin Code")
                {
                    IncludeCaption = true;
                }

                column(Lot_No_; "Lot No.")
                {
                    IncludeCaption = true;
                }
                dataitem(QAExpiryDate; "Tracking Specification")
                {
                    DataItemLink = "Source ID" = field("Document No."), "Lot No." = field("Lot No."), "Item No." = field("No.");
                    column(Expiration_Date; "Expiration Date")
                    {
                    }
                }
                dataitem(QA; "QA Answer")
                {
                    RequestFilterFields = "Source No. 3";
                    column(QA_Questionnaire_Code; "QA Questionnaire Code")
                    {
                        IncludeCaption = true;
                    }
                    column(QA_Question_Category_Code; "QA Question Category Code")
                    {
                        IncludeCaption = true;
                    }

                    column(Answer; Answer)
                    {
                        IncludeCaption = true;
                    }
                    column(Source_No_; "Source No.")
                    {
                        IncludeCaption = true;
                    }

                    column(Source_No__3; "Source No. 3")
                    {
                        IncludeCaption = true;
                    }

                    dataitem(QAC; "QA Question Category")
                    {
                        DataItemLink = "Code" = field("QA Question Category Code");

                        column(CategoryDescription; Description)
                        {
                            IncludeCaption = true;
                        }
                    }



                    dataitem(QAHeader; "QA Header")
                    {
                        DataItemLink = "Source No." = field("Source No."), "Source No. 3" = field("Source No. 3");
                        column(HeaderQuestionnaire_Code; "QA Questionnaire Code")
                        {
                        }
                        dataitem(ExpiryDate; "QA Questionnaire Header")
                        {
                            DataItemLink = "Code" = field("QA Questionnaire Code");
                            column(Ending_Date; "Ending Date")
                            {
                                IncludeCaption = true;
                            }
                        }
                    }

                }
            }

        }
    }

}


The report appears with the Document Number in the filter - I want to make it better by passing the Lot Numbers as well that are on the Sales Order Lines

pastedimage1665773820027v1.png

Any suggestions how to do that?

  • Verified answer
    Amit_Sharma Profile Picture
    Amit_Sharma 2,545 on at
    RE: How to pass multiple filter values to a Report Request

    Hi,

    Make extension of Report for adding the Filter in the Request page.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,744 Moderator on at
    RE: How to pass multiple filter values to a Report Request

    To be able to do that you should extend the sub page  "Sales Order Subfom"instead of the main page.

    So extend the page where you show the sales lines. Then you will have access to the serial no. of your selected sales line.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,537 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,520 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans