FlexReport for UWP | ComponentOne
C1.UWP.FlexReport Assembly / C1.Xaml.FlexReport Namespace / DataSource Class / Filter Property
Example

In This Topic
    Filter Property
    In This Topic
    Gets or sets the expression used to filter which data rows are included in the report.
    Syntax
    'Declaration
     
    Public Property Filter As String
    public string Filter {get; set;}
    Remarks

    Use the Filter property to restrict the records that you want to include in a data source without modifying the RecordSource property.

    Using a filter is similar to specifying a WHERE clause in the SQL statement assigned to the RecordSource property. Both techniques will filter the data according to the condition specified. The difference is that the Filter property is applied to a table that has already been loaded in memory, while the WHERE statement causes only the filtered records to be loaded from the database into memory.

    When creating reports that include only small subsets large tables, the WHERE statement is a better option, because it doesn't require the entire table to be loaded into memory. On the other hand, if the table has already been loaded in memory, the Filter property is a better option, since it does not require any additional data to be loaded.

    The syntax for the filter expression is determined by the FilterSyntax property.

    Example
    The code below shows how to apply a filter to a data source using the Filter property and using a WHERE clause in a SQL statement:
    if (useFilterProperty)
    {
    	// load all records, filter in memory
        _c1r.DataSource.RecordSource = "SELECT * from Employees";
        _c1r.DataSource.Filter = "HireDate >= '1/1/1993' AND Country = 'UK'";
    }
    else
    {
    	// load selected records only
        _c1r.DataSource.RecordSource = "SELECT * from Employees " +
            "WHERE HireDate >= #1/1/1993# AND Country = 'UK'";
    See Also