Web Reports

JReport provides the web reporting solution which is aimed at easier and faster report creation and design, faster report execution, easier customization, and better presentation style using a newer Rich Internet Application (RIA) Web 2.0 interface. A web report contains only one report and uses .wls as the file suffix.

The data sources that can be used to create web reports are business views that are resources built on top of queries. In JReport Designer, you can create web reports based on business views, and publish them to JReport Server. JReport Designer supports opening, creating, and editing of web reports.

In JReport Server, end users can create web reports via the Web Report Wizard using a browser and open and edit web reports via Web Report Studio (for details, see the Web Report Studio chapter in the JReport Server User's Guide). Web reports created in JReport Server can also be downloaded to JReport Designer for editing.

Pick a task from the following:

Notes:

 

Components supported in web report

Components are the objects that you can place in a report. JReport provides a full set of components that allow you to present and control the report data and presentation in a wide variety of ways.

Web reports support the following report components:

Creating a web report

To create a web report:

  1. Click File > New > Web Report on the menu bar.
  2. A blank web report with a tabular of one cell is displayed. You can then split the tabular, insert components to the tabular cells, and modify the component properties if required. For details, see the corresponding topics about the specific component in the Components chapter.

Using dynamic resources in web report

When working with a web report, sometimes you may find that the view elements that have been predefined in the business view the web report uses cannot meet your requirements, in which case, you can create some dynamic resources and use them in the report to get the desired data. Then when you save the web report, the dynamic resources will be saved along with it as its resources.

Dynamic resources are report level resources, which means they are only available to the report for which they are created.

Dynamic resources that can be used in web reports include formulas and aggregations.

Creating and using dynamic formulas

To create a dynamic formula:

  1. In the Resource View panel of the main window, or in the Resources box of the report wizard, expand the Dynamic Resources > Formulas node, click <Add Formula…>.
  2. In the Input Formula Name dialog, specify the name of the formula and click OK. The Formula Editor appears.
  3. Create the formula according to your requirement.
  4. From the Use As drop-down list on the toolbar, specify whether the formula is used as Group, Detail or Aggregation.

    Whether a dynamic formula can be used as a certain type depends on the following rule:

  5. Save the formula and exit the Formula Editor.

Once a dynamic formula has been created, you can then drag it from the Resource View panel to the desired position in the report as a detail/group or an aggregation object as defined, or use it when working with the report wizard.

In the Resource View panel, you can make use of the shortcut menu of an existing dynamic formula to edit or delete the formula, or change the formula type as Group, Detail, or Aggregation if possible.

Notes:

Creating and using dynamic aggregations

You can also create dynamic aggregations by mapping them to the available resources such as group objects, detail objects in the current business view, and the dynamic formulas that have been created in the web report.

To create a dynamic aggregation:

  1. In the Resource View panel of the main window, or in the Resources box of the report wizard, expand the Dynamic Resources > Aggregations node, then click <Add Aggregation…>. The Add Aggregation dialog appears. See the dialog.
  2. In the Aggregation Name text field, specify the name of the dynamic aggregation.
  3. Click next to the Mapping Name text field to specify the field on which the dynamic aggregation is based.
  4. From the Aggregate Function drop-down list, specify the aggregate function.
  5. When done, click OK to create the dynamic aggregation.

Once a dynamic aggregation is created, you can then drag it from the Resource View panel to the desired position in the report to get the desired data, or use it when working with the report wizard.

For any dynamic aggregation, you can further modify if needed. To do this, right-click the aggregation and select Edit from the shortcut menu. Then in the Edit Aggregation dialog, edit the aggregation as required.

For dynamic aggregations that are on longer required, you can remove them. To delete an aggregation, right-click it and click Delete on the shortcut menu. Aggregations that have been used in report cannot be deleted.

Using formulas to control showing or hiding components

The Invisible property of the objects in a web report can be controlled by a formula. For details about how to use formulas to control object properties, click here.

However, for any object whose parent doesn't have a data source, for example, a label in the tabular cell of a web report, if you want to use a formula to control its Invisible property, you need to first bind a business view to the web report, then you can create formulas of Boolean type based on this business view to control the property.

To bind a data source to a web report:

  1. Click Edit > Bind Data on the menu bar. The Bind Data dialog appears. See the dialog.
  2. Select a business view in the current catalog.
  3. Click OK to bind the business view to the web report.

After binding the data source, you can now create formulas in this business view to control the Invisible property of objects in the web report, whose parents don't have data source. To do this:

  1. Select the object and find its Invisible property in the Report Inspector.
  2. Click in the value cell of the Invisible property and select the <Create Formula...> item from the drop-down list.
  3. In the Input Formula Name dialog, specify the name of the formula and click OK. The Formula Editor appears.
  4. Create the formula according to your requirement. You need to specify whether the formula is used as Group, Detail, or Aggregation by setting the Use As option on the toolbar.
  5. Save the formula and exit the Formula Editor.
  6. The formula name is now displayed in the value cell of the Invisible property.

    Then at runtime, whether the object is shown or hidden will be determined by the return value of the formula. A return value of true will hide the component.

The formula you created on the bound data source will be regarded as a dynamic formula in the selected business view, and you can find it in the Dynamic Resources > Formulas node of the Resource View panel. So there is another way to create formulas in the business view and use it directly when editing the Invisible property. To do this:

  1. Click any blank area in the report body. The business view bound to the web report will be displayed in the Resource View panel.
  2. Expand the Dynamic Resources > Formulas node, click <Add Formula…>, then create the formula as required.
  3. Edit the Invisible property of the desired object, click in the value cell and you will find the formula is listed in the drop-down list.

Editing a web report

After a web report is built up, you can further modify it the same as you do with page report. For details, see Editing a page report.

Previewing a web report

To preview a web report, do either of the following:

The web report will then be opened in Web Report Studio. You can also click the View tab directly to preview the web report in JReport format, or select other format from the Preview As submenu to display it in that format.

Moreover, when previewing a web report, if it is developed with National Language Support, you can specify the language in which you want the report to display; if it contains parameters, you will be prompted to specify values for the parameters in the Enter Parameter Values dialog.

Notes:

Saving a web report

To save a web report, click File > Save on the menu bar, or the Save button on the Standard toolbar. This operation can also be accomplished by pressing the Ctrl + S keys. If the web report to be saved is new, the Save Report As dialog will appear for you to input a name.

To save a web report with a different name in the current directory:

  1. Click File > Save As on the menu bar.
  2. In the Save Report As dialog, type a new file name in the Report Name field.
  3. The web report file type Web Report (*.wls) is the only default value in the Report of Type drop-down list.
  4. Click Save to save the web report with the new name.

To save a web report to a different catalog, refer to Saving a page report to a different catalog.

Opening a web report

To open a web report:

  1. Click File > Open on the menu bar, or the Open button on the Standard toolbar.
  2. In the Open Report dialog, browse to find the catalog that contains the web report you want to open.
  3. In the Reports tab, select Web Report (*.wls) from the Report of Type drop-down list.
  4. All the web reports in the current catalog will be displayed. Select the desired web reports.

    If you want to open web reports that you have opened recently, switch to the Recent tab, and then select the web reports you want to open.

  5. Click Open to open the web reports that you specified.

Tip: If you just want to access some recently open web reports, click File > Open Recent and then select the web reports one by one from the submenu.