#### Using slider or filter control to filter data

A slider or filter control is used to filter one or more data components in a report or library component. It can do filtering based on the fields in the data sources the data components are created from.

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 data sources 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 report, 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, then click OK. The filter tool will be inserted in the report, 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 data source. 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 components.

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 slider

Slider is only available for library component at present and can only be inserted into the body of a library component.

To insert a slider into a library component:

1. Do one of the following:
   - Drag Slider from the Toolbox panel to the destination.
   - Click Insert > Web Controls > Slider on the menu bar, then click the mouse button in the destination.
   - On the Insert toolbar, click the down arrow on the Insert Control Objects button and select Slider from the drop-down list, then click the mouse button in the destination.

   The Insert Slider dialog appears. See the dialog.

2. Choose whether the slider is used to specify a range of values or just a single value.
3. From the resource list in the Select Fields box, 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.

4. By default, all the values of the selected fields will be available for the slider, which may be too many for a slider. However you can customize the values to show. 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 type a value or select a value from the drop-down list. Repeat the operation to add more values. To remove a value, select the line and click .
      - To specify the value range, specify a value in the From and To text fields respectively.
   3. For fields of Date/Time type, you can also specify a special function.
   4. Click OK to save the customized values. The customized values will be available on the slider for choosing.
5. The Apply To drop-down list provides the components involving the selected fields. Select the components which you want to filter.
6. When done, click OK to insert the slider. Then at runtime, end users can select the values on the slider to filter the specified data components.

After a slider is inserted into a library component, you can further modify it if necessary. To do this, right-click the slider and select Edit Slider from the shortcut menu. In the Edit Slider dialog, edit the slider according to your requirements.

##### Using filter control

To insert a filter control into a report:

1. Do one of the following:
   - Drag Filter Control from the Toolbox panel to the destination.
   - Click Insert > Web Controls > Filter Control on the menu bar, then click the mouse button in the destination.
   - On the Insert toolbar, click the down arrow on the Insert Control Objects button and select Filter Control from the drop-down list, then click the mouse button in the destination.

   The Insert Filter Control dialog appears. See the dialog.

2. From the resource list in the Select Fields box, select the fields of the same data type to bind to the filter control. The name of the first displayed field you select in the dialog will be displayed as the field name of 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.

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 to insert the filter control. Then at runtime, all values of the specified fields will be listed in the filter control. End users can select one or more values to apply.

When a filter control is inserted into a report, you can further modify it if necessary. To do this, right-click the filter control and select Edit Filter Control from the shortcut menu. In the Edit Filter Control dialog, edit the filter control according to your requirements.

After inserting filter controls in a 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.