Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Designing a RDLC Custom Report in Business Central

Posted on by 281

Dear Members,

I would like to know whether it is possible to create RDLC Report with a temporary table as its source table in Business Central. I tried with the code which I had attached below for your refference. I am able to design the report and but when I try to run the report by uploading it in the custom report layouts, I am getting the following error message: "The report couldn’t be generated, because it was empty. Adjust your filters and try again."

 I had designed the report by inserting it (Fields) into the table. I am not able to get the values in the rdlc report as it shows the report is empty.

The code with which I had tried to create the report is as below:

report 50109 Reportname
{
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;
    Caption='Test Report';
    RDLCLayout = 'TestReport.rdl';
    DefaultLayout=RDLC;
   
    dataset
    {
        dataitem(Temporarytable_name; Temporarytable_name)
        {
            column(Amount;Amount)
            {
           
            }
            column(AmountIncVAT;AmountIncVAT)
            {

            }
            column(Bill_to_Name;Bill_to_Name)
            {
               
            }
            column(Manufacturing_Orgin;Manufacturing_Orgin)
            {

            }
            column(BusinessUnit;BusinessUnit)
            {

            }
            column(DocumentNo;DocumentNo)
            {

            }
            column(ItemNumber;ItemNumber)
            {

            }
            column(Class;Class)
            {

            }
            column(Order_Date;Order_Date)
            {

            }
            column(ShipmentDate;ShipmentDate)
            {

            }
            column(Product_Name;Product_Name)
            {

            }
            column(Product_Type;Product_Type)
            {

            }
            column(Quantity;Quantity)
            {

            }
            column(VendorName;VendorName)
            {
               
            }
        }
    }
   
    requestpage
    {
        layout
        {
            area(Content)
            {
                group(GroupName)
                {
                   
                }
            }
        }
   
        actions
        {
            area(processing)
            {
                action(ActionName)
                {
                    ApplicationArea = All;
                   
                }
            }
        }
    }
   
   
   
   
}
Can you suggest me ways to achieve solution to create a custom report from temporary table ..?
Thanks in Advance,
Saravanan M
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    RE: Designing a RDLC Custom Report in Business Central

    Hi, Whether there is data in the report has nothing to do with the layout file. You can use the following method to confirm whether the data is generated. I suspect that itself is empty.

    pastedimage1676616887324v1.png

    pastedimage1676616906141v2.png

    It seems that your "TempTable" is also a temporary table, please confirm your table design again.

    Hope this can give you some hints.

    Thanks.
    ZHU

  • M Saravanan Profile Picture
    M Saravanan 281 on at
    RE: Designing a RDLC Custom Report in Business Central

    Dear YUN ZHU,

    I noticed that you had created the report with temporary table in docx format. I would like to know whether it is possible to create report in RDLC Format..??

    As of now, I had designed the report and used the triggers as instructed in your blog. But, the same issue persist [ "The report couldn’t be generated, because it was empty. Adjust your filters and try again."]. I had attached the currently working code below for your reference.

    report 50110 TempReport

    {

        UsageCategory = ReportsAndAnalysis;

        ApplicationArea = All;

        RDLCLayout = TempReport.rdl';

        DefaultLayout = RDLC;

     

        dataset

        {

            dataitem(TempTable; TempTable)

            {

                column(Amount; Amount)

                {

     

                }

                column(AmountIncVAT; AmountIncVAT)

                {

     

                }

                column(Bill_to_Customer_No_; Bill_to_Customer_No_)

                {

     

                }

                column(Bill_to_Name; Bill_to_Name)

                {

     

                }

                column(Currency_Factor; Currency_Factor)

                {

     

                }

                column(CustomerAddress; CustomerAddress)

                {

     

                }

                column(Description; Description)

                {

     

                }

                column(Invoice_Discount_Amount; Invoice_Discount_Amount)

                {

     

                }

     

                column(ItemNo_; ItemNo_)

                {

     

                }

                column(Line_Discount__; Line_Discount__)

                {

     

                }

                column(Line_Discount_Amount; Line_Discount_Amount)

                {

     

                }

                column(No_; No_)

                {

     

                }

                column(Order_Date; Order_Date)

                {

     

                }

                column(Quantity; Quantity)

                {

     

                }

                column(Quote_No_; Quote_No_)

                {

     

                }

                column(Shipment_Date; Shipment_Date)

                {

     

                }

                column(Unit_of_Measure; Unit_of_Measure)

                {

     

                }

                column(Unit_Price; Unit_Price)

                {

     

                }

                column(VAT__; VAT__)

                {

     

                }

                column(Your_Reference; Your_Reference)

                {

     

                }

     

            }

        }

     

        trigger OnPreReport()

        var

            TempTablename: Record TempTable;

        begin

            TempTable.Reset();

            TempTable.DeleteAll();

            TempTablename.Reset();

     

            if TempTablename.FindSet() then

                repeat

                    TempTable.Init();

                    TempTable.Amount := TempTablename.Amount;

                    TempTable.AmountIncVAT := TempTablename.AmountIncVAT;

                    TempTable.Bill_to_Customer_No_ := TempTablename.Bill_to_Customer_No_;

                    TempTable.Bill_to_Name := TempTablename.Bill_to_Name;

                    TempTable.Currency_Factor := TempTablename.Currency_Factor;

                    TempTable.CustomerAddress := TempTablename.CustomerAddress;

                    TempTable.Description := TempTablename.Description;

                    TempTable.Invoice_Discount_Amount := TempTablename.Invoice_Discount_Amount;

                    TempTable.ItemNo_ := TempTablename.ItemNo_;

                    TempTable.Line_Discount__ := TempTablename.Line_Discount__;

                    TempTable.Line_Discount_Amount := TempTablename.Line_Discount_Amount;

                    TempTable.No_ := TempTablename.No_;

                    TempTable.Order_Date := TempTablename.Order_Date;

                    TempTable.Quantity := TempTablename.Quantity;

                    TempTable.Shipment_Date := TempTablename.Shipment_Date;

                    TempTable.Unit_of_Measure := TempTablename.Unit_of_Measure;

                    TempTable.Unit_Price := TempTablename.Unit_Price;

                    TempTable.VAT__ := TempTablename.VAT__;

     

                    TempTable.Insert();

                until TempTablename.Next() = 0;


        end;

     

    }

     

    Please do suggest me ways to create a report in RDLC Format.

     

    Thanks in advance,

    Saravanan Murugesan

  • M Saravanan Profile Picture
    M Saravanan 281 on at
    RE: Designing a RDLC Custom Report in Business Central

    Dear YUN ZHU,

    Thanks a lot for making a post based on the above discussion. Now I am able to create a report with the temporary table.  Hopefully, this post would help others who were looking for the same. Thanks a bunch..!!!

    Kind regards,

    Saravanan M

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    RE: Designing a RDLC Custom Report in Business Central

    Hi, just updated a simple post, hope it gives you some hints.

    Dynamics 365 Business Central: Creating Report with temporary table

    https://yzhums.com/34290/

    Thanks

    ZHU

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    RE: Designing a RDLC Custom Report in Business Central

    Hi, As mentioned by several experts above, your report uses a temporary table (it looks like you are using "TableType Property = Temporary" in Temporarytable_name), you need to insert data before running the report, otherwise there will be no data no matter what the filter conditions are.

    Some info about TableType Property = Temporary

    https://yzhums.com/3427/

    And you can also use a  temporary record variable.

    Below is some discussion that hopefully gives you some hints.

       

    https://forum.mibuso.com/discussion/6773/how-to-create-a-report-which-is-based-on-a-temporary-table

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Designing a RDLC Custom Report in Business Central

    The thing with temp tables is that they do only hold data as long as they are in the scope of a transaction. So the data you put in a temp table will be deleted once the current transactions goes out of scope. Therefor you need to insert data in the temp table at the beginning of the report processing for the report to be able to find any data in the table when the report is executed.

    learn.microsoft.com/.../devenv-temporary-tables

    www.youtube.com/watch

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Designing a RDLC Custom Report in Business Central

    Hi,

    Before running the Report with temp table, please provide some data in Temp table. and after the run the report.

    Thanks.

  • M Saravanan Profile Picture
    M Saravanan 281 on at
    RE: Designing a RDLC Custom Report in Business Central

    Dear Inge M. Bruvik,

    Thank you for replying. I am not able to understand the meaning of the term "Populate the temp table with data". Can you please elaborate on the steps I need to follow to solve the error that I am facing .???

    Thanks in advance,

    Saravanan M

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Designing a RDLC Custom Report in Business Central

    If you want to use a temporary table as a data item in your report you need to make sure to populate the temp table with data as part of your report code.

    If you are not doing that the temp table will always be empty when you run the report and you will get the error you experience.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Designing a RDLC Custom Report in Business Central

    I dont know about the temporary table issue but the error is due no data available , please check your filter

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans