Filtering component data

When creating or editing dashboards, you can filter component data using two types of web controls: sliders or filter controls.

Filter controls allow you to pick one or more random values from a list and are used with categorical or nominal variables. You can choose one or more values from anywhere in the list and there is no mean or median value calculation possible such as States and Countries.

Sliders allow you to pick one or more sequential values from a list and are used for interval variables such as dates, times, quantity and currency variables where the slider represents the scale from lowest to highest value and the middle represents the median value.

Think about what you need and choose the proper filtering tool.

Filtering scenarios

Both sliders and filter controls have the same filtering mechanism.

Filtering based on one field is a common usage. Bind a field to a slider or filter control, and then based on the field to filter the data of the components created from the same data source as the field.

Another special usage is to filter components using different data sources. Choose a common field all the data sources contain and then bind a slider or filter control with the common field in all the data sources, that is, in the insertion dialog, select the common field under the nodes of all the data sources.

For example, there are two components containing data from different data sources, and you want to filter their data using one filter tool. The precondition is that both components have the field you want to filter. For example, you would like the two components to show the data of a specific country. In order to do this, insert a slider or a filter control according to your requirement into the dashboard body, then in the insertion dialog, select both the country fields from the two data sources (different data sources may use different names for the country field, for example, data source 1 uses "Country", data source 2 uses "P_Country", in this case, you need to select both "Country" and "P_Country"), then from the Apply To drop-down list, select the two components you want to filter. The filter tool will be inserted in the dashboard body, and you can see it lists country names which come from the two data sources. In the filter tool select one or more countries, then the two target components will be filtered and only display the data of these selected countries.

When you bind a slider or filter control with multiple different fields, be sure the list of values in each field match so that when you select a value, such as Country, P_Country and S_Country, it will match the appropriate country field in each component. The logic is the values are OR that is Field1=SelectedValue1 or Field2=SelectedValue1 or Field3=SelectedValue1. Therefore, when Field1, Field2 and Field3 are used in different components you will see the records correctly in each component.

When you bind a slider or filter control with multiple different fields which do not contain the same list of values such as Country, Region and Territory, at runtime after you select values in the slider or filter control, the filter condition will use OR logic to apply the selected values to all the fields of the slider or filter control, for example, Field1=SelectedValue1 or Field2=SelectedValue1 or Field3=SelectedValue1. In this case, when there are three fields but the list of values in each field do not match, the result will have no matching records for two of the components and therefore become blank components. We recommend that you use three different filter tools in cases like this.

Using sliders

To insert a slider to the dashboard body:

  1. Click Show Resources on the side bar to display the Resources panel.
  2. From the Toolbox node, drag Slider to the destination in the dashboard body. The Insert Slider dialog appears. See the dialog.
  3. In the Title text field, input a title for the slider.
  4. Choose whether the slider is used to specify a range of values or just a single value.
  5. From the resource list, select the fields of the same data type to bind to the slider.

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

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

  6. By default, all the values of the selected fields will be available on the slider, which may be too many for a slider. However you can customize the values you want to show on the slider. To do this,
    1. Click the Customize button to display the Customize Value dialog.
    2. Uncheck the Select All option. You can then customize the values.
      • To specify values one by one, click to add a value line, then in the line to type a value or select a value from the drop-down list. Repeat the operation to add more values. To remove a value, select its line and then click the button.
      • To specify the value range, specify a value in the From and To text boxes respectively.
    3. For fields of the Date/Time type, you can also specify a special function.

      For details about the special functions, refer to Specifying special function for group by field in the JReport Designer User's Guide.

    4. Click OK to save the customized values. The customized values will be available on the slider for choosing.
  7. The Apply To drop-down list provides the components involving the selected fields. Select the components which you want to filter.
  8. Click OK. A slider bound with the specified fields will be inserted in the dashboard body. You can then specify values in the slider to filter the specified components.

You can further modify the sliders inserted into a dashboard if you want. To do this, click on the title bar of a slider and select Edit Setting from the drop-down list. In the Edit Slider dialog, edit the setting as required.

Using filter controls

To insert a filter control to the dashboard body:

  1. Click Show Resources on the side bar to display the Resources panel.
  2. From the Toolbox node, drag Filter Control to the destination in the dashboard body. The Insert Filter Control dialog appears. See the dialog.
  3. In the Title text field, input a title for the filter control.
  4. 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 via one filter control, find a common field these data sources contain, then select the field in each of the data sources.

  5. The Apply To drop-down list provides the components involving the selected fields. Select the components which you want to filter.
  6. Click OK. A filter control bound with the specified fields will be inserted in the dashboard body. You can then specify values in the filter control to filter the specified components.

    To easily locate the values you want in the filter control, you can make use of its quick search toolbar. To display the toolbar, click on the field name bar. The button on the field name bar is used to cancel the selection of values in the filter control. For detailed usage about the quick search toolbar, refer to Select Values dialog.

You can further modify the filter controls inserted into a dashboard if you want. To do this, click on the title bar of a filter control and select Edit Setting from the drop-down list. In the Edit Filter Control dialog, edit the setting as required.

Notes: