Creating a parameter
To create a parameter in a catalog, follow the steps below:
- In JReport Designer, open the catalog file in which you want to create the parameter.
- In the Data tab of the Catalog Browser, expand the data source that will include the parameter, right-click the Parameters node, and then select Add Parameter to bring up the Create Parameter dialog. See the dialog.
- In the Name field, input a name for the parameter.
- Select a parameter type from the Value Setting drop-down list. For parameters in XML connection, it can only be Type-in Parameter.
- In the values section, specify the parameter values as required. The section varies with the type you select from the Value Setting drop-down list.
- For Type-in Parameter:
- Specify the data type of the parameter value from the Value Type drop-down list.
- Click to add a value line, double-click in it and then type in a value of the specified data type.
If the parameter is of Date, DateTime, or Time type, you can also click the calendar button to set a date and time value using either calendar or built-in formula functions.
- Repeat the second step to add more values.
To adjust the order of the values, click or ; to remove any unwanted value, select it in the list and then click .
- Specify the value which will be set as the default selected value in the Enter Parameter Value dialog by selecting it from the list.
- For Bind with Single Column:
- From the Source drop-down list, select the required data source type: Tables and Views, Stored Procedures, Imported SQLs, or User Defined (for parameters in MongoDB connection, only Tables and User Defined are available). Then, all fields in the specified catalog data source of the type will be available for value selection.
- Select a field from the Bind Column drop-down list. This field is used to filter the query when running a report with the parameter.
- If you want the values of another field to be displayed in the Enter Parameter Values dialog, which makes more sense to report end users than the values of the Bind Column field, select that field from the Display Column drop-down list.
- For Bind with Cascading Columns:
- From the Data Source drop-down list, select the required data source among these types: tables, views, stored procedures, imported SQLs, and user defined data sources (for parameters in MongoDB connection, only tables and user defined data sources are available). Then, all fields in the specified catalog data source will be available for value selection.
- Click to add a parameter row.
- Click in the Bind Column cell and select a field from the drop-down list.
- If you want the values of another field to be displayed in the Enter Parameter Values dialog, which makes more sense to report end users than the values of the Bind Column field, click in the Display Column cell and then select that field from the drop-down list.
- Click in the Parameter cell to create the parameter. A name for the parameter will then be automatically added by JReport.
- Repeat step 2 to 4 to create more parameters. Make sure that the selected Bind Column fields are of cascading relationship one level by one level down. In this way a group of cascading parameters will be created.
To adjust the order of the parameters, click or ; to remove any unwanted parameter from the cascading group, select it and then click .
- In the Options box, set options for the parameter according to your requirements.
- When done, click OK to create the parameter.