Skip to main content
Post a question

Notifications

Community site session details

Community site session details

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

How to populate a Temporary Table in a report from a Query

Like (5) ShareShare
ReportReport
Posted on 31 Mar 2025 21:21:43 by 67
Relatively new to BC coding using AL.  I have created a Query that I use to populate a Temp Table, which is then used to build a Page.  I followed this link, which was extremely helpful.  https://yzhums.com/4869/
 
I have also used the Query to create an RDLC report, which works great, but as I understand it, you cannot define Report Filters when the DataSet is a Query.
 
So I would like to use the Query to load data into the Temp Table so I can utilize the Report Filters.
 
I am trying to use the OnPreReport trigger in the report.al file, but the table is empty (apparently) as I get an error saying there is no data in the report.
 
Not sure what I am missing, but does anyone have some sample code I can review to see how this is done?
 
I am attaching the Query, Temp Table, and report.al (based on the Query) that I have so far.
  • ME-31032107-0 Profile Picture
    67 on 04 Apr 2025 at 21:32:42
    How to populate a Temporary Table in a report from a Query
    , thank you.  Your post was very helpful to me being able to get what I needed.  Thanks!!
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    12,667 Super User 2025 Season 1 on 04 Apr 2025 at 15:07:50
    How to populate a Temporary Table in a report from a Query
  • Verified answer
    gdrenteria Profile Picture
    16,714 Most Valuable Professional on 03 Apr 2025 at 13:48:05
    How to populate a Temporary Table in a report from a Query

    Hi, good day
    I hope this can help you, and give you some hints.

    How to design a high performant inventory report in Business Central - D365 Business Central Freelance Developer

    Best Regards
    Gerardo

  • ME-31032107-0 Profile Picture
    67 on 01 Apr 2025 at 10:31:39
    How to populate a Temporary Table in a report from a Query
    , I have read that article and am trying to replicate it, but it is not working.  If you were successful, can you share your code so I can see what I am missing?
  • ME-31032107-0 Profile Picture
    67 on 01 Apr 2025 at 09:59:36
    How to populate a Temporary Table in a report from a Query
    , thanks for your reply.  I am not trying to filter the dataset, but rather have the ability for the report to add a filter in the UI, like when using the RequestFilterFields = "No.".  When I try to use it, I get the error "Reference No. in application object Integer does not exist".
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    12,667 Super User 2025 Season 1 on 01 Apr 2025 at 07:17:11
    How to populate a Temporary Table in a report from a Query
    I can see the value in report
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    12,667 Super User 2025 Season 1 on 01 Apr 2025 at 04:14:34
  • Suggested answer
    YUN ZHU Profile Picture
    80,142 Super User 2025 Season 1 on 31 Mar 2025 at 23:26:20
    How to populate a Temporary Table in a report from a Query
    Hi, hope the following helps.
    Dynamics 365 Business Central: How to use a query to create a report dataset (Creating Report with Query)
     
    As for filtering, you can try adding it to the trigger below.
     
    Hope this helps.
    Thanks.
    ZHU
  • ME-31032107-0 Profile Picture
    67 on 31 Mar 2025 at 21:31:37
    How to populate a Temporary Table in a report from a Query
    I forgot to attach the files, here they are.  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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,382 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,534 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Loading complete