Preview and run reports
When you run a report, you'll be presented with the request page of the report. The request page allows you to decide if you want to preview, print, export, or schedule the report implementation.
Request page
The following screenshot shows actions that you can complete on the request page. For example, on the Customer List page, you can find a Report section in the actions menu. When you select the Customer - Sales List report in the Report action menu, the request page of that report will open.
The request page enables users to specify options and filters for a report. By default, a request page is displayed, unless UseRequestPage is set to false; then, the report will begin printing as soon as it's run. In this case, users can't cancel the report run. It's still possible to cancel the report, but some pages might print.
By default, if other filters aren't set, a request page will always display the following buttons:
Send to
Print
Preview
Cancel
Additionally, you can add more options on the request page to allow the user to filter the data that is displayed.
The columns that you define as RequestFilterFields are shown on the request page, and you can use them for filtering the data before viewing or printing the report.
We recommend that you add columns that report users will frequently set filters on.
You can define the RequestFilterFields property in the dataitem() part of the report code as illustrated in the following code example:
report 50103 "Customer List"
{
CaptionML = ENU = 'Customer List';
RDLCLayout = 'Customer List Report.rdl'; // if Word use WordLayout property
dataset
{
dataitem(Customer; Customer)
{
RequestFilterFields = "No.", "Search Name", "Customer Posting Group";
...
By default, for every data item in the report, a FastTab for defining filters and sorting is created on the request page. To remove a FastTab from a request page, make sure that you do not define RequestFilterFields for the data item and that you set the DataItemTableView property in a report to define sorting. The request page will display, but no tab will be available for this data item.
In addition to defining the filter options by setting the RequestFilterFields
property, you can add a requestpage
section on reports. In this section, you
can set the SaveValues property to true to save the values that the user
enters on the request page. When the report is run again, the user will have the
option to use previously defined filters. You can also add a layout to the request
page, specifying an Options section to perform checks.
With request pages that have SaveValues = true, users can preview the report multiple times in the client and the request page will remain open. If SaveValues = false or is omitted, a Preview & Close action appears on the request page. In this case, the request page will close after the report has been previewed.
...
requestpage
{
SaveValues = true;
layout
{
area(content)
{
group(Options)
{
Caption = 'Options';
field(PostingDate; PostingDateReq)
{
ApplicationArea = Basic, Suite;
Caption = 'Posting Date';
ToolTip = 'Specifies the posting date for the invoice(s) that the batch job creates. This field must be filled in.';
}
}
}
}
trigger OnOpenPage()
begin
if PostingDateReq = 0D then
PostingDateReq := WorkDate;
end;
var
PostingDateReq: Date;
}
...
If a DataItemTableView or SourceTableView is not defined, then users can select a sort column and sort order at runtime.
In a complex report that uses data from several tables, the functionality might depend on a specific key and sort order. Design your reports so that users can't change the sort order in a way that affects their functionality.
For data items whose source table contains calculated fields, such as amounts and quantities, the Filter totals by section will be included automatically on the request page, which allows you to adjust various dimensions that influence calculations.
The fields under Advanced will set limitations on the generated report to control printer resources. Typically, you won't have to change these settings unless you have a large report. If a report exceeds these limitations when you try to preview or print, a message will appear telling you which limitation was exceeded. Then, you can change the settings to suit your report. However, each field has a maximum value that you should be aware of:
Maximum rendering time = 12:00:00
Maximum rows = 1000000
Maximum documents = 500
The maximum values might differ for Business Central on-premises, and an administrator can change them.
Preview a report
Previewing a report lets you see what the report will look like before you print it. The preview isn't based on the printer that is selected in the Printer field on the request page; it's controlled by the browser. After previewing, you can return to the request page and change options and filters as needed.
To preview a report, select the Preview or Preview & Close button on the report request page. The button that displays depends on the report, so some reports have a Preview button, while others will have a Preview & Close button. Both buttons will open a preview of the report. The difference is that Preview keeps the request page open so that you can go back to it, make changes, preview again, or print. With Preview & Close, the request page closes, so you'll need to open the report again to make changes or print it.
In the preview of a report, you can use the menu bar on the report preview to:
Move through pages.
Zoom in and out.
Resize to fit the page.
Select text. You can copy text from a report and then paste it somewhere else, like a page in Business Central or Microsoft Word. For example, you can use a mouse to press and hold where you want to start, and then move the mouse to select one or more words, sentences, or paragraphs. Then, you can right-click Copy and paste the selected text where you want it.
Pan the document. You can move the visible area of the report in any direction so that you can view other areas of the report. Panning is helpful when you have zoomed in to see details. For example, press and hold the mouse button anywhere in the report preview and then move your mouse.
Download to a PDF file on your computer or network.
Print the report.
Exporting a report
In the Request page of a report, when you select Send To…, the following options are available:
PDF Document
XML Document
Microsoft Word Document
Microsoft Excel Document (data and layout)
Microsoft Excel Document (data only)
Schedule...
To see an actual representation, an export of the layout of the report, use one of the following options:
PDF Document
Microsoft Word Document
Microsoft Excel Document (data and layout)
To see the underlying dataset of the report, use one of the following options:
XML Document
Microsoft Excel Document (data only)
If you're a developer or advanced user, it helps to inspect the data that is generated for a given report dataset while you create new reports or modify existing ones. To support this capability, you can export a report dataset as raw data to an Excel workbook or XML file directly. In Excel, for example, you can then do ad-hoc analysis of the data and diagnose issues.
The Microsoft Excel Document (data only) option exports the report results and the criteria that was used to generate them, but it doesn't include the report layout. The Excel file will include the full dataset as raw data, arranged in rows and columns. All data columns of the report's dataset are included, regardless of whether they're used in the report layout.
Once you have the Excel file, you can start analyzing the data. For example, you could filter the data and use Power Pivot to display it.
Each time you export results, a new worksheet is created. Using the Microsoft Excel Document (data only) option, you can run the same report and reuse formatting changes. For example, for Power Pivot, you can run the report again for another time period, copy the results to the worksheet, and then refresh the worksheet.
The Microsoft Excel Document (data only) option exports all columns, including columns that hold filters and formatting instructions for other values. Here are a few additional points of interest:
Binary data in a field, like an image, isn't exported. In columns that hold binary data, fields will include the text Binary data ({0} bytes), where {0} indicates the number of bytes.
The Excel file also includes the Report Metadata worksheet. This worksheet shows the filters applied to the report and general report properties, like the name, ID, and extension details. The filters are shown in the Filter(DataItem::Table::FilterGroupNo::FieldName) column. The filters in this column include filters set on the report's request page. It also includes filters defined in AL code, for example, by the DataItemLink property and DataItemTableView property.
Similar to the Export dataset to Excel (no layout) option that was added, business users and developers can now get report datasets in XML directly from the request page.
The Export dataset to XML feature will show up in the same place in the request page and also will require the same privileges.
Schedule a report to run
You can schedule a report or batch job to run at a specific date and time. Scheduled reports and batch jobs are entered in the job queue and processed at the scheduled time, similar to other jobs. Select the Schedule option after you have selected the Send to button, and then you can enter information such as printer, time, and date.
The report is added to the job queue and will be run at the specified time. When the report is processed, the item will be removed from the job queue.
When you schedule a report to run, you can specify that it must run every Thursday by setting the Next Run Date Formula field to D4, for example.
You can choose to save the report to a file, such as an Excel, Word, or PDF file, and then print it to a selected printer or only generate the report. If you choose to save the report to a file, then the processed report is sent to the Report Inbox area on your Role Center, where you can view it.
Print a report
To print a report, select the Print button on the request page or on the menu bar of the Preview page.
The Printer field on the request page shows the name of printer that the report will be sent to. To change a printer, select the printer from the list.
The (Handled by the browser) value indicates that no printer is designated for the report. In this case, the browser will handle the printout and display a standard experience, where you can choose a local printer that is connected to your device. The (Handled by the browser) value isn't available in the Business Central mobile app or the app for Microsoft Teams.
The printer that's selected for you by default is set up on the Printer Selections page. The next section explains how you can set up printers.