Reporting

In Telerik Reporting, you can filter report data before or after it is retrieved for a report.

To filter data before it is retrieved, change the query for each data source. When you filter data in the query, you filter data at the data source, which reduces the amount data that needs to be retrieved and processed in a report.

To filter data after it is retrieved, create filter expressions in the report. You can set filter expressions for a data item, or a group, including detail groups.

Filters can contain report parameters in filter expressions, providing a way to filter data for specific values or for specific users, for example, filtering on a value that identifies the user viewing the report. Filters are defined using the the Edit Filter Dialog.

Filtering conditions are defined by adding Filter objects to the Filters collection of the data items or groups. Each Filter object is made up of an expression, an operator and a value:

  • Expression – can be either a single data field or a combination of multiple expressions. See Expressions.
  • Operator
    OperatorDescription
    >Expression is greater than Value
    <Expression is less than Value
    >=Expression is greater than or equal to Value
    <=Expression is less than or equal to Value
    =Expression is equal to Value
    <>Expression is not equal to Value
    LikeExpression is like Value. Use the "%" wildcard to represent any number of other characters. Example: Fields.ProductName Like "%Bike%" will allow all records where the "ProductName" field contains "Bike".
    Not LikeExpression is Not like Value. Use the "%" wildcard to represent any number of other characters. Example: Fields.ProductName NotLike "%Bike%" will allow all records where the "ProductName" field does not contain "Bike".
    Top N

    Return the top N number of records, where N is an Integer.

    If Expression is blank the filter returns the exact number of records specified by Value. For example "Top N 5" returns exactly five records. 

    If Expression contains a field or expression the filter returns the top number for that expression. This filter may return more than the exact count specified in Value. For example "ProductCategory Top N 2" might return twenty records containing ProductCategory "Accesories" and "Apparel".

    Bottom N

    Return the bottom N number of records, where N is an Integer.

    If Expression is blank the filter returns the exact number of records specified by Value. For example "Bottom N 5" returns exactly five records. 

    If Expression contains a field or expression the filter returns the bottom records for that expression. This filter may return more than the exact count specified in Value. For example "CountryRegion Bottom N 2" might return twenty records containing "Zambia" and "Zimbabwe".

    Top %

    Returns the top N percentage of records, where N is an Integer.

    If Expression is blank the filter returns the percentage of total records specified in Value. If the report has an initial 1000 records and the filter is "Top % 5", 50 records are returned.

    If Expression contains a field or expression the filter returns the bottom percentage records that satisfy the expression. For example if the top two percent country codes in a StateProvince table are "AS", "AU" and "CA" might return twenty records containing only those country codes. 

    Bottom %

    Returns the bottom N percentage of records, where N is an Integer.

    If Expression is blank the filter returns the percentage of total records specified in Value. If the report has an initial 1000 records and the filter is "Bottom % 5", 50 records are returned.

    If Expression contains a field or expression the filter returns the bottom percentage records that satisfy the expression. For example if the bottom two percent country codes in a StateProvince table are "VI", "US" and "PW" might return twenty records containing only those country codes. 

  • Value – a literal value, an expression or an empty (<blank>) value, which will be compared to the Expression when evaluated at runtime.
Tip

If you type the character "7" in the Value cell, by default this evaluates to the string "7". To compare a numeric expression with the number "7", use the expression syntax which begins with an equal sign: =7.

Data items and groups may have one or more Filters defined, that at runtime are combined and applied together to the data.

Depending on where the Filter is applied - to a data item or group – it can produce different result:

  • A filter defined on the data item level limits the data from the data source and all subsequent operations will be performed of this subset of data. These filters operate over the entire set of data and should not use the aggregate functions for the Expression and Value members. Data item filters work similar to the WHERE clause in a SQL statement;
  • A filter defined on a report/table group limits the group members to a certain values. These filters operate over the group members after the groups are calculated and can contain aggregate functions. Group filters are similar to the HAVING clause in a SQL statement.

In This Section