## Running reports

If you know the default format for viewing reports and this format is what you expect, use direct running. If you would like a different view format or to customize some other information such as parameter values, the running priority, how to save the result, the expiration time, and so on, use advanced running.

### Direct running

Direct running reports is to use the default format setting to view the report result. For page reports (for example, .cls) the default format is Page Report and they will run in Page Report Studio. For web reports (.wls) they will be opened in Web Report Studio by default.

If the reports are created on JReport Server, the default format is controlled by the Default Format for Viewing Report option in the Profile > Customize Server Preferences > General tab. When this option is set to Page Report or Applet, web reports will run in Web Report Studio by default.

If the reports are created using JReport Designer, the default format is controlled by the Default Format for Viewing Report property in the Report Inspector. If this property is set to <Server Setting>, the viewing format will be determined by the above setting on server. For page reports this property is available to each report tab in the reports, while for web reports it is available to each report.

Since a page report can contain multiple report tabs and these report tabs may have different default format settings, for example, report tab 1 is Page Report, tab 2 HTML and tab 3 Excel. In this case, there will be different direct running results according to which report tab is the last-time focused tab in the page report when the page report is saved at report design time. If it is report tab 1, all the tabs in the page report will be opened in Page Report Studio. If it is report tab 2 or 3, only tab 2 or 3 will be displayed in the specified format, and this applies to all the other formats except Page Report.

To directly run a report, on the JReport Console > Resources page, browse to the report, then do one of the following:

- Click the name of the report in the Name column of the Resources page.
- Select the report row and click Run > Run on the task bar of the Resources page.
- Select the report row, right-click in the row and select Run from the shortcut menu.
- Put the mouse pointer over the report row and click the Run button on the floating toolbar.

Then, if the report contains parameters, the Enter Parameter Values dialog will be displayed. Specify the parameter values according to your requirements.

### Advanced running

1. On the JReport Console > Resources page, browse to the report you want to run.
2. Do either of the following to open the Advanced Run dialog.
   - Select the report row, then on the task bar of the Resources page, click Run > Advanced Run.
   - Select the report row, right-click in the row and select Advanced Run from the shortcut menu.
   - Put the mouse pointer over the report row and click the Advanced Run button on the floating toolbar.
3. In the General tab, for a page report, select the report tabs in the page report you want to run. If there are multiple dynamic connections available, expand the Select Dynamic Connection section and select a connection from the drop-down list. Click Connection Properties to view the connection information if needed. Then, specify the other options as required.
4. In the Parameter tab, specify the parameter values if the report has parameters.
5. In the Format tab, choose a format to view the report result, and set the other settings.
6. In the Archive tab, archive the report result version according to your requirements.
7. If you want to limit the amount of time that the report is allowed to run, in the Duration tab, specify a time duration for the task, and ask JReport Server to cancel the task or to notify you or someone else of the task status via e-mail if the task has not yet finished running when the task duration is up. For detailed information, see Task-level timeout for advanced run and schedule tasks.
8. Click Finish to view the report in the format you specified.

   When running a page report in Page Report Studio, the report processing page will appear, on which you can choose to cancel the running of the report, or to make the report run in background mode. Click Cancel on this page if you decide to cancel, Background if you want the report to run in background mode, or just wait for processing to complete. If you cancel the report from running, you can choose whether to cancel the running query used by the report in the database at the same time by configuring the JdbcDriversConfig.properties file. For details, refer to Canceling running query.

Notes:

- If you choose to view a page report in Page Report format, besides the selected report tab, all the other tabs in the report will also be run.
- When you run a report in Advanced mode in HTML format, the names of page navigation links in the report, such as First, Previous, Next, and Last, can be localized according to your requirements. For details, refer to Localizing page navigation links in HTML report outputs.
- When you run a report in Advanced mode in Applet format or in HTML format with Applet Chart is checked for it using Google Chrome, the report can run correctly only when NPAPI is enabled for the web browser. To do this, you need to type chrome://flags/ in the address bar of the web browser, then scroll down and set Enable NPAPI Mac, Windows to Enable.
- By default, the Duration tab is not displayed in the Advanced Run dialog. To make it available, the Enable Task Duration option on the JReport Administration page > Configuration > Advanced panel must be checked.

### Running a page report in background mode

When you run a report in Page Report Studio, if the report contains a large amount of data, you need to wait several minutes before the report result is displayed, and during this period, you have to remain on the report processing page, or choose to cancel the run. Now JReport enables you to switch running page reports to background mode.

To make a report running in Page Report Studio to run in background mode, on the report processing page, click the Background button.

You can also specify to run page reports automatically in background mode after a specified time period by setting preferences. To do this:

1. On the JReport Administration page, click Profile on the system toolbar and then select Customize Profile from the drop-down menu. Or on the JReport Console page, click Profile on the system toolbar, then click Customize Profile on the task bar of the Profile page.
2. Click the Page Report Studio > Properties > Advanced tab.
3. Check Background Mode Timeout and specify the time allowed for a page report to run in foreground mode.
4. Save the settings, then when a report runs in Page Report Studio and the results have not yet been generated after the specified time, it will be automatically switched to run in background mode.

Reports running in background mode are listed in the Background Tasks table of the My Tasks page, which shows detailed running information of the reports, such as report path and name, catalog path and name, running format, time when the task is started/completed, and so on. Also, you can control the status of the reports running in background mode according to your requirements. For example, you can choose to delete, stop, or restart tasks (for details, see Managing tasks in the task tables).

When a report completes running in background, you can open it from the Background Tasks table, and once the report is opened, the task will automatically be removed from the table.