web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Report from temporary table

(4) ShareShare
ReportReport
Posted on by 831

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.

I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    10,975 Super User 2025 Season 2 on at
    Report from temporary table
    Hi! Glad to hear the post helped. Let me explain steps 3 and 4 a bit more clearly:
     
    Step 3 – OnAfterGetRecord trigger:
    This is where you loop through the temporary data inside the report. Since you're using a temp table, you don’t use the normal data item loop. Instead, you manually control the loop by using the OnAfterGetRecord trigger of the data item. You basically move through your global temp record inside this trigger, record by record.
     
    Step 4 – Column bindings:
    Since the standard data item (Rec) is empty in this case, you shouldn’t bind the columns directly to it. Instead, each report column should pull data from your global temporary record variable, like this:
     
    column(No; TempRec."No.") { }
     
    That way, the report shows values from your temp record, not the (empty) default data item.
     
    Let me know if you need a code snippet example — happy to share!
     
    ✅ Mark this answer as verified if it helps you.
     
     
  • Marcus Halbauer Profile Picture
    100 on at
    Report from temporary table
    Hello @Nick Webb,
     
    I am experiencing exactly the same issue as you have described in this post.
    Your post has been really helpful and is probably the only promising solution which I have found so far.
     
    However, could you please evaluate what you mean in step 3 and 4 of the report object, i.e.:
    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.") { }
     
    Thank you for your help!
  • Verified answer
    Nick Webb Profile Picture
    831 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
    3,035 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
    21,605 Moderator 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,869 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,484

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,242

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans