Selecting a Data Source for Running the Complex Report

You select a data source to retrieve data for the report and the query input control; otherwise the report and the list of users in the query input control will be blank.

To select a data source and run the complex report:

1. On the Controls & Resources page of the JasperReport wizard, select Data Source.
2. On the Locate Data Source page, choose Select data source from repository.
3. Click Browse, choose Organization > Data Sources > JServerJNDI Data Source, and lick Select.
4. On Link a Data Source to the Report, click Submit.
5. On the Locate Query Page, click Submit again to save the complex report.

Skip the Query and Customization pages of the JasperReport wizard to use the default settings on those pages.

The server validates the report and a message appears indicating that the report was added to the repository.

6. In the Repository, click the name New Complex Report to run and view the report.

Input controls appear.

7. Enter these input values, as shown in “Input Controls Dialog for the New Complex Report”:
a. Text Input Control: myText
b. Check Box Input Control: Check the checkbox.
c. List Input Control: Select Third Item.
d. Date Input Control: Click and select December 31, 2010.
e. Query Input Control: Select Sarah Smith from the drop-down.

Input Controls Dialog for the New Complex Report

8. Click OK or Apply to run the report with the selected input, including the incorrect non-numerical input for the Text Input Control.

The server enforces the proper format defined for each input control. You defined the Text Input Control as a numeric type, so it accepts only valid numbers, as indicated by the message to specify a valid float number, as shown in “Invalid Input Message”.

Invalid Input Message

9. In Text Input Control, enter 3 and click OK or Apply.

The sample report includes a header that displays the value of each parameter received from the input controls. Values and labels appear in the language specified by the active resource bundle, in this case English.

Output Controlled by Input

In the report viewer, you can open the Input Controls dialog at any time by clicking the Options button. Click OK to run the report using the chosen values and close the Input Controls dialog; click Apply to run the report using the chosen values, but keep the Input Controls open for choosing other values and re-running the report.

If you get an error when you run the report, open it for editing as described in Editing JRXML Report Units. Review your settings. If you can’t find the problem, edit the SalesByMonth sample report (in the repository at /reports/samples) and compare its settings to your report.

To see the message written by the scriptlet JAR on the last page of the report, click in the report viewer.