Viewing: Running Reports > Simple Input Controls

Running a Report with Input Controls or Filters

As you run a report that has input controls, you can specify the data that you want to see. When you run a report based on a Domain Topic that defines a filter, the server can render the filter as an input control.

Simple Input Controls

The Freight Report example has three input controls: Country, Request Date, and Order ID. Using input controls, you run the a report with one set of data and then another.

To run a report with simple input controls:

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

The search results are displayed.

2. Click the name Freight Report in the list of results.

The report appears:

 

Freight Report with Country = Mexico by Default

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

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

The Input Controls dialog box appears:

 

Setting Country = USA in the Input Controls Dialog Box

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

 

The Apply button in Input Controls refreshes the report with the new data, but keeps Input Controls open. You can continue interacting with the report to find data you need, such as shipping reports for other countries.

5. In Input Controls, click OK.

The report shows data for USA instead of Mexico:

 

Freight Report With Country = USA

6. Click Options to display Input Controls again.

You are prompted to name the new set of values.

7. Enter USA as the new name:

 

Naming the Saved Values

8. 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 Input Controls.

 

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

9. In Input Controls, click OK:

 

Input Controls With a List of Saved Values

10. In the report viewer, click the Back button to display the search results page.
11. In search results, click the icon next to Freight Report to display 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,

12. 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.
13. In the Properties dialog box, enter a description for the saved version of the report:

 

Adding a Description to a Saved Version of a Report

14. 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. In contrast to cascading input controls, every value chosen for a simple input control is independent of the other values. For more information, see About Cascading Input Controls.

The following example demonstrates cascading input controls that are required to run a 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. Click the name Cascading multi select example report in the list of results.

Instead of running the report, you are prompted to enter new values.

3. Select a different country, for example, Mexico, in the Country multi select drop-down.

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 names field updates to reflect the choice of state:

 

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. The other drop-down lists update to reflect user choices.

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

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