Udostępnij za pośrednictwem


How to: Filter Data in a Report (Visual Studio Report Designer)

You can define filters on a data region to select or exclude parts of the dataset that is used by the data region. Filters limit the data that is displayed to the user after all of the data is retrieved. Because the full set of data is retrieved and then filtered when the report is processed, the report may not perform as well as a report gets filtered data another way (specifically, if you write code that filters the data before it is passed to the report).

To add a filter to a data region

  1. Open the client report definition (.rdlc) file in graphical design mode.

  2. Select the data region on which you want to define the filter. If the data region is a table or matrix, click the table or matrix so that column and row handles appear above and next to the table or matrix.

  3. Right-click the corner handle of the table or matrix, or anywhere within the list or chart, and then click Properties.

  4. On the Filters tab, for Filter, do the following:

    • In Expression, type or select the expression that you want the filter to evaluate.

    • In Operator, select the operator that you want the filter to use to compare the evaluated field and the value.

    • In Value, type the expression or value against which you want the filter to evaluate the value in Expression.

To add a filter to a table group or matrix group

  1. Click the table or matrix so that column and row handles appear above and next to the table or matrix.

  2. Right-click the corner handle of the table or matrix and then click Properties.

  3. On the Groups tab, select the group to edit, and then click Edit.

  4. On the Filters tab, for Filter, do the following:

    • In Expression, type or select the expression for the field that you want the filter to evaluate.

    • In Operator, select the operator that you want the filter to use to compare the evaluated field and the value.

    • In Value, type the expression or value against which you want the filter to evaluate the value in Expression.

To add a filter to a list group

  1. Right-click the list and then click Properties.

  2. On the General tab, click Edit details group.

  3. On the Filters tab, for Filter, do the following:

    • In Expression, type or select the expression for the field that you want the filter to evaluate.

    • In Operator, select the operator that you want the filter to use to compare the evaluated field and the value.

    • In Value, type the expression or value against which you want the filter to evaluate the value in Expression.

To add a filter to chart groups

  1. Right-click the chart and then click Properties.

  2. On the Data tab, select a category group or a series group and then click Edit.

  3. On the Filters tab, for Filter, do the following:

    • In Expression, type or select the expression for the field that you want the filter to evaluate.

    • In Operator, select the operator that you want the filter to use to compare the evaluated field and the value.

    • In Value, type the expression or value against which you want the filter to evaluate the value in Expression.

See Also

Concepts

Adding Table Data Regions (Visual Studio Report Designer)
Adding Matrix Data Regions (Visual Studio Report Designer)
Adding List Data Regions (Visual Studio Report Designer)
Adding Charts to a Report (Visual Studio Report Designer)
Grouping Data in a Report (Visual Studio Report Designer)