## Previewing a report

In the process of designing a report, you can preview the report at any time in the following two ways:

- Previewing a report in JReport format
- Previewing a report in other formats

Notes:

- You can set the TOC Anchor property to true in the Report Inspector for components that you want to show in the TOC tree. In addition, you can also specify the display value for every component that you want to show by setting the Anchor Display Value property in the Report Inspector.
- If a report is developed with National Language Support, when you preview it, you can specify the language in which you want the report to display.

### Previewing a report in JReport format

To preview a report in JReport Format when designing it at any time, just click the View tab, which then causes the JReport Engine to run the report. The result is then shown in the viewer. To optimize performance, JReport Designer displays report pages before they have been completely generated. For details about the options in the View tab, see section Design/View area. In addition, when previewing a report, you are enabled to dynamically sort the report records and drill down the aggregate level fields.

#### Dynamic sort

You can sort the records in the report dynamically in the View area. To do this:

1. Point to the field you want to sort.
2. Right-click the field and select the option Sort Ascending or Sort Descending from the shortcut menu.

#### Drill-down

You can drill down on aggregate level fields in your report. Drill-down is made possible where there is a summary for a group. For example, if a report has been grouped by Customer Region, and the group summary is on Annual Sales. When viewing the report, if you point the mouse at the total annual sales for a region, it will turn into a small hand. Click on the total, and the drill-down report for the selected region will be displayed. See illustration.

By default, in cases like the above, JReport's convention is to hide the detail section of each group and only show it in a drill-down report. To do this, select the detail section, and go to the Report Inspector. Set its Invisible property to true. Then view the report again, and it will be shown without details. See illustration.

Note: After some modifications in the design area, if you find the report is shown very quickly and the changes are not applied in view mode, this means you need to click the Refresh Data button on the toolbar to re-run your report.

### Previewing a report in other formats

JReport also allows you to preview your report in the following formats: DHTML, HTML, PDF, Excel, Text, RTF, XML and PostScript.

To preview a report in other formats, take one of the following:

- On the View menu, select the specific format from the Preview As submenu.
- Click the Preview As button on the Standard toolbar and select the required item from the drop-down list.

By selecting one of the formats, the report will be exported to a temporary file, which can be viewed in the format with appropriate application. The temporary file will be removed when you exit JReport Designer.

Notes:

- The function of previewing a report in DHTML is enabled only if you have checked the option DHTML Preview (Necessary for previewing DHTML reports) when installing JReport Designer.
- The preview server is a web ad hoc disabled server, and it supports only one user and one report set concurrently.
- JReport Designer and the preview server are running in two separated JVMs. The preview server applies `-Djreport.url.encoding=UTF-8` in the startup batch file and this setting covers URL encoding/decoding. Therefore, when you preview a report in DHTML format, if the name of the report or its report set or catalog file contains non-Latin characters, you need add `-Djreport.url.encoding=UTF-8` into the startup batch file of JReport Designer as well; otherwise the preview will fail.
- When previewing a report in DHTML format,
  - Make sure the JDBC driver's class path has been appended to setenv.bat/setenv.sh in `<install_root>\server\bin.`
  - If the report contains some user defined objects (UDO), to have them work correctly in the preview server, you need to compile your Java files again using report.jar and JREngine.jar in the `<install_root>\server\lib` directory, modify the udo.ini file in `<install_root>\server\lib` and append the classes to the class path of JREntServer.bat in `<install_root>\server\bin`. For details, see Creating a UDO manually.
  - If the report contains some user defined data sources (UDS) or user defined formulas (UDF), you can use the classes you have compiled for using in Designer, but remember to append the classes to the class path of JREntServer.bat in `<install_root>\server\bin`.