Since Dynamics 365 Business Central 2020 Wave 2 (version 17.x) it is now possible to run multiple report preview without the need of launching the request page multiple times.
See the official enhancement entries
This brand new experience is driven by the SaveValues Request Page property
Together with SaveValues, since version 17.2, there is a new Report property that influence the multiple report preview: AllowScheduling.
The Multiple Report Previews creates NEW Report object instances every time the request page runs. This implies all the triggers will be re-executed every time from scratch.
Therefore, there is a trade-off if you are in need to use consistently the report and request page triggers (e.g. OnInitReport, OnOpenPage).
To showcase the remarkable differences within the execution, you might create a simple page extension and a report as per the following
pageextension 50110 "Employee List Extension" extends "Employee List"
{
actions
{
addafter("Ledger E&ntries")
{
Action(RunMultiplePreviewReport)
{
Caption = 'Run Multiple Preview Report';
Promoted = true;
PromotedIsBig = true;
Image = Report;
PromotedCategory = Process;
ApplicationArea = All;
trigger OnAction();
var
Employee: Record Employee;
MultiplePreviewReport: Report "Multiple Preview Report";
ActionTextVar : Text;
begin
ActionTextVar := 'WhateverValue';
Employee.SetRange("No.",Rec."No.");
if Employee.FindFirst() then begin
MultiplePreviewReport.SetTableView(Employee);
MultiplePreviewReport.SetTextVar(ActionTextVar);
MultiplePreviewReport.RunModal();
end;
end;
}
}
}
}
report 50110 "Multiple Preview Report"
{
DefaultLayout = RDLC;
ApplicationArea = All;
UsageCategory = ReportsAndAnalysis;
RDLCLayout = 'DummyLayout.rdl';
//This value is disabling Multiple Preview Feature (if set to false)
AllowScheduling = false;
dataset
{
dataitem(EmployeeDataItem; Employee)
{
column(No_;"No.") {}
column(GlobalTextVar;GlobalTextVar) {}
column(OnInitReportVar;OnInitReportVar) {}
column(OnOpenPageVar;OnOpenPageVar){}
trigger OnAfterGetRecord()
begin
Message('OnAfterGetRecord:[%1][%2][%3]',GlobalTextVar,OnInitReportVar,OnOpenPageVar);
end;
}
}
requestpage
{
//This value enable Multiple Report Preview (if set to true)
SaveValues = true;
trigger OnOpenPage();
begin
OnOpenPageVar := Random(50000);
Message('OnOpenPage:[%1][%2][%3]',GlobalTextVar,OnInitReportVar,OnOpenPageVar);
end;
}
trigger OnInitReport();
begin
OnInitReportVar := random(50000);
Message('OnInitReport:[%1][%2][%3]',GlobalTextVar,OnInitReportVar,OnOpenPageVar);
end;
procedure SetTextVar(var LocalTextVar: Text);
begin
GlobalTextVar := LocalTextVar;
end;
var
GlobalTextVar: Text;
OnInitReportVar : Integer;
OnOpenPageVar: Integer;
}
with a simple RDL file to show the output in a Tablix within the body (well, this is not necessary, since the same is reported through messages)
Now, let's play with AllowSchedule \ SaveValues parameter and take note of the outcome.
When doing some stuff before running the report it has some very important considerations and side effects (see NOTE column).
|
AllowSchedule\SaveValues |
Preview button type |
OnInitReport |
OnOpenPage |
OnAfterGetRecord |
NOTE |
|
TRUE\TRUE |
Preview |
No-Yes-No |
Yes-Yes-Yes |
No-Yes-Yes |
OnInitReport and OnOpenPage will be executed multiple times. No messages are thrown. Values from the first OnOpenPage will be different from the OnAfterGetRecord because of the new report object creation. |
|
TRUE\FALSE |
Preview & Close |
No-Yes-No |
Yes-Yes-Yes |
Yes-Yes-Yes |
Every value will be consistent / the same and triggers executed just one time |
|
FALSE\FALSE |
Preview & Close |
No-Yes-No |
Yes-Yes-Yes |
Yes-Yes-Yes |
Every value will be consistent / the same and triggers executed just one time |
|
FALSE\TRUE |
Preview & Close |
No-Yes-No |
Yes-Yes-Yes |
Yes-Yes-Yes |
Every value will be consistent / the same and triggers executed just one time |
Again, this remarks the trade off between SaveValues vs run the report consistently in all the experiences (print / preview / schedule).

Report
All responses (