Viewing: Running Reports and the Report Viewer > Simple Input Controls

Running a Report with Input Controls or Filters

The server filters the data in the report output when you run a report with an input control. The perfect input control limits the data to what you want to see—and nothing more. When you run a report based on a Domain Topic that defines a filter, the server can render the filter as an input control.

If your system administrator has enabled the Data Snapshot feature (described in section Data Snapshots), tt is important to note that the default input controls - that is, the input controls as defined when the original iReport- or Ad Hoc View-based report is run - will overwrite any changes made to them the next time you run a report. For instance, suppose you run a report, update the input controls, then save the report. At a later date, you run a report from the iReport or Ad Hoc View source again. That new report will replace the report you ran earlier, and your input control changes will be lost.

To avoid this, save your updated reports with a different name than the default. That way, when subsequent reports are run from the same source, they will not overwrite your report (unless they are given an identical name when saved).

Simple Input Controls

The Freight Report example has three input controls:

   Country

   Request Date

   Order ID

Using input controls, you run the report with one set of data and then another. When saved, an instance of the report with alternate input controls is called a Report Version, and is labeled as such in the repository.

To run a report with simple input controls:

1.     In the search field, enter freight and click .

2.     In the list of search results, click the name, Freight Report.

The report shows data about orders numbered 10600 and above, shipped to Mexico after June 1, 1997.

 

Freight Report Showing Mexican Data

3.     To run the report with other input option values, click .

The Input Controls dialog appears:

 

Default Input Controls

4.     Select USA in the Country field, and click OK.

 

The Apply button refreshes the report with the new data, but keeps the Input Controls dialog open.

The report shows data for the USA instead of Mexico:

 

Freight Report Showing USA Data

5.     Click to display Input Controls again. Click Save.

You are prompted to name the new set of values.

6.     Enter USA as the new name.

7.     To save the set of input options, click Save.

The Input Controls dialog box reappears.

A drop-down list showing USA as a set of saved values appears in the Input Controls Used saved values menu.

 

The Reset button in Input Controls restores the default input values, set during the report design.

8.     In Input Controls, click OK.

 

Input Controls With a List of Saved Values

9.     In the Report Viewer, click the Back button to display the search results page.

10.     In search results, click the icon next to Freight Report to display the link to the saved, USA version of the report:

The New Version of the Report in the Search Results

 

You can click the name of the saved version, for example USA, to run the report using the saved input control values,

11.     Add a description to the saved version of the report:

In the search results page, right-click the saved version, USA, and select Properties from the context menu.

a. In the Properties dialog box, enter a description for the saved version of the report:

12.     Click Submit.

The new description appears below the report when you refresh the display.

Cascading Input Controls

Cascading input controls in a report reduce a large number of choices to a manageable number. A single value chosen for a cascading input control determines which other values appear as choices for input. For example, the choice of a country determines which states or regions are listed as choices. For more information, see section Selecting a Data Source for Running the Complex Report.

To run a report with cascading input controls:

1.     In the Search field at the top of any JasperReports Server page, enter cascading and click .

The search results are displayed in the repository.

2.     In the search results, click the name Cascading multi select example report.

The report runs, and appears with the Options panel open on the left side of the Report Viewer

3.     In the Options panel’s Country multi select drop-down, select a different country, for example Mexico.

The other drop-downs in the Input Controls dialog box are automatically updated with Mexican data.

 

Cascading input controls are implemented as queries that access the database to retrieve the new values. The server displays an activity monitor while the query is running, and in the case of long queries, you can click Cancel and select different values.

4.     In the Cascading state multi select control drop-down, select a different state, for example Guerrero.

The Cascading name single select drop-down is updated to list accounts in Guerrero.

 

Cascading Input Controls

 

The report design defines country and state input controls as multi-select; users can Ctrl-click to select multiple values in such lists.

5.     Click Apply to run the report with the chosen values.

The report creates a list of all account names in the chosen states. The report lists the account name chosen in the Cascading name single select input control at the top.

As with simple input controls, you can save these Options settings as a new Report Version. To do this, click Save to open the Save Values dialog. Name the new version, then click Save.