Skip to main content
A newer version of this page is available. .

Conditionally Filter Report Data

This document describes how to filter a report’s data based on a specific condition.

Note

You can use this approach to conditional filtering when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Expressions or DataBindingMode.ExpressionsAdvanced.

See Conditionally Filter Report Data to learn about the legacy approach to solving this task.

See Data Binding Modes to learn more about the available binding modes.

  • Switch to the Field List, right-click the Parameters section and add a new report parameter.

    field-list-add-parameter

  • Specify the parameter’s description in Print Preview and set its type to Number (Integer).

    parameter-min-unit-price

  • Select the report’s detail band and switch it to the Visual Studio property grid. Navigate to its Expressions section and click the Visible property’s ellipsis button (you can find it under the BeforePrint event’s category if you are using the ExpressionsAdvanced binding mode).

    detail-band-expression-visible

  • This invokes the Expression Editor where you can specify the required filter expression. For example:

    detail-band-expression

    The expression above makes the Visible property return True or False depending on whether the unit price is below the specified parameter value.

When switching to Print Preview, you can make the report display only products with the unit price above the specified parameter value:

conditional-filtering-preview-result