### Using web controls

Web controls are report components designed to be similar to the kinds of controls found on web pages. In Web Report Studio, these four types of web controls can be applied: parameter control, parameter form control, filter control, and navigation control.

This section describes each of the web controls and how to use them.

#### Using parameter control to specify a parameter to a report

A parameter control is a web control that is bound with a parameter used by the current report. By specifying values to the parameter in a parameter control, you can pass the parameter values to JReport and run the report with the specified values.

Cascading parameters cannot be used in parameter controls. If you want to do this, use parameter form controls instead.

To insert a parameter control and use it to specify a parameter to a report:

1. Drag Parameter Control from the Components panel to the destination in the report. The Insert Parameter Control dialog appears. See the dialog.

2. Select the parameter you would like to add to the parameter control, then click OK.
3. A parameter control will be added into the report. Specify the value for the parameter. You may specify the value in one of these ways.
4. Once the value in the parameter control changes, the report will rerun with the new parameter value.

Note: If the specified parameter is no longer used in the report, the parameter control will become invalid.

#### Using parameter form control to run reports

A parameter form control is a web control that is bound with the parameters used by the current report or other reports. By specifying values to the parameters in a parameter form control, you can make the reports run with the specified parameter values.

To insert a parameter form control and use it to run reports:

1. Drag Parameter Form Control from the Components panel to the destination in the report. The Insert Parameter Form Control dialog appears. See the dialog.

2. Specify the target reports to run using the parameter form control.
   - To run the current report, select Current Report, then specify the parameters used to run the report from the Select Parameters box.
   - To run other reports, select Others, then select the reports you want to run. If all the selected reports contain no parameters, you cannot finish the dialog.
3. Specify whether to include the Submit button in the parameter form control. If Submit is included, it is used to submit the parameter values you specified in the parameter form control. If Submit is not included, once you change the values of a parameter in the parameter form control, the new values will be applied automatically.
4. Click OK in the dialog to save the changes.

   The parameter form control is now inserted in the report. It lists the selected parameters for the current report or lists all parameters used by the specified reports.

5. In the parameter form control, specify values of the listed parameters. You may specify the values in these ways.
6. Click the Submit button to run the current report or the specified reports if the button is available. If there is no Submit button, the change of values in the parameter form control will trigger report rerunning.

Note: If you save or publish a report containing a parameter form control to another directory, the reports that you bind the parameter form control with will not be saved or published along with the report.

#### Using filter control to filter report data

A filter control is used to filter one or more data components in a report, which refer to tables, charts, and crosstabs. For how a filter control works, see Filtering scenarios.

To insert a filter control and use it to filter report data:

1. Drag Filter Control from the Components panel to the destination in the report. The Insert Filter Control dialog appears. See the dialog.

2. From the resource list, select the fields of the same data type to bind to the filter control.

   To filter components created from the same data source, select a field in the data source.

   To filter components created from different data sources, find a common field these data sources contain, then select the field in each of the data sources.

3. The Apply To drop-down list provides the components involving the selected fields. Select the components which you want to filter.
4. When done, click OK.

   The filter control is inserted in the report. It lists all values of the specified fields. You can select one or more values to apply.

After inserting filter controls in the report, you can also insert a navigation control for undoing/redoing the value selection in the filter controls. For details about the usage of navigation control, see Using navigation control to undo/redo value selection in filter controls.

##### Managing a filter control

After right-clicking on a filter control, these options are available for managing the filter control.

- Edit
  Opens the Edit Filter Control dialog for editing the filter control.
- Search
  Displays the quick search toolbar right above the value list which enables you to search values in the filter control. You can also click the Search button on the title bar of the filter control to launch the quick search toolbar. For detailed usage about the quick search toolbar, refer to Select Values dialog.
- Clear
  Cancels the selection of values in the filter control. You can also use the button on the title bar to cancel the selection. This operation can be undone/redone.
- Sort
  Sorts the values in the filter control in the ascending or descending order.
- Delete
  Removes the filter control from the report and the filter you created with the filter control will be removed from the report too. You can also use the button X on the title bar to delete the filter control.
- Hide
  Hides the filter control.
- Properties
  Opens the Filter Control Properties dialog for editing the properties of the filter control. The dialog provides an entry to changing the data fields that the filter control is based on and the application scope. To do this, in the General tab, click beside the Filter On text box. Then in the Select Field dialog, change the settings as you like and click OK.
- Position
  Specifies the position of the filter control.

##### Cascading relationship between filter controls

When there are filter controls that apply to the same data components, and when these controls' fields have cascading relationship, the cascading relationship will be revealed when you select values in the controls.

For example, there is a filter control based on the field Country, a filter control on City, and another on State. The first two share one table while the third shares nothing with the other two. In this case, Country and City values will show cascading relationship, but State values will not participate. You select USA in the Country filter control, the values in the City filter control will change as follows if the control has scrollbar: the cities belong to USA are displayed in the upper area of the filter control, and the other cities are put in the lower area and grayed out. For the case that the City filter control has no scrollbar: all the values remain their positions and the values not belonging to USA are grayed out. In both cases all the values are selectable. But the State values remain as before, since the selection of them will not affect the data components that the Country and City filter controls control.

Notes:

- When there are more than 300 values in a filter control, JReport will use Big Data Loading logic. In this case, the Shift Key for multiple selection will not work.
- Sometimes, when the position of a filter control is changed due to layout change, the advanced search toolbar in the filter control may not follow the filter control but stay where it is.

#### Using navigation control to undo/redo value selection in filter controls

A navigation control can be considered as an accessorial control for filter controls and used to deal with the value selection operations in all the filter controls in the same report.

To insert a navigation control into a report, drag Navigation Control from the Components panel to the destination in the report.

A navigation control is a combination of three buttons:

- Back
  Goes back to the previous value selection status and refreshes the report data accordingly.
- Clear
  Removes all the value selection histories and all the filter conditions based on the selections, and refreshes the report data accordingly.
- Forward
  Goes forward to the next value selection status and refreshes the report data accordingly.