Skip to main content

Notifications

Business Central forum
Suggested answer

Report from temporary table

Posted on by 668

I have a list page for which the source table is temporary. I can see on screen that there are plenty of records displayed. However, when I try and run a report from it, as below

report.RunModal(Report::CustomTrialBalanceByDim, false, false, Rec);

I get:

The report couldn’t be generated, because it was empty. Adjust your filters and try again.

Rec.Count contains a value of over a thousand, so there is data to process.

Is it because the table is temporary? If yes, what do I have to do differently? I've done this a bunch of times using permanent tables.

  • Nick Webb Profile Picture
    Nick Webb 668 on at
    RE: Report from temporary table

    Thanks all for your help. I got there in the end. Here's a quick summary of what I did:-

    In the Report object:

    1. Define a global var of the temporary Record type.
    2. Define a public procedure (e.g.) FillTempRecordSet, that takes in a parameter of temporary Record type and feeds the data from the passed-in Record object to the global object. (Uses Record.TransferFields)
    3. Define an OnAfterGetRecord trigger to iterate through the recordset
    4. Each column should be using the global record var (e.g.) column(No; TempRec."No.") { }

    In the trigger OnAction() of the calling Page object:

    1. Define a Report object var
    2. Call the public procedure (e.g.) ReportObject.FillTempRecordSet and pass in Rec
    3. Call ReportObject.RunModal

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,025 on at
    RE: Report from temporary table

    Hi,

    Pls create replica of this data when you open the page. And from that replica table, create report and run.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,027 Super User 2024 Season 1 on at
    RE: Report from temporary table

    Hi,

    Yes, if the Table is set to temporary by any reason so in that case you can see the data only when you open the page, if you will try to create a Report with the table, in that case report will not show you anything or give error.

    Better to check how data is transferring to Temp Table, and try to create one more Replica of of this Temp Table, and transfer data into your new table and then design your report with this new table.

    After you show your data in report, just delete all data from new table, not to make any duplicate data.

    Thanks.

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

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans