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

Announcements

News and Announcements icon
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 911

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
    Nitin Verma Profile Picture
    21,812 Moderator on at

    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.

  • Suggested answer
    Amit Baru Profile Picture
    3,043 on at

    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

  • Verified answer
    Nick Webb Profile Picture
    911 on at

    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

  • Marcus Halbauer Profile Picture
    100 on at
    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!
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,177 Super User 2026 Season 1 on at
    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.
     
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,496 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 961 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 870 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans