ComponentOne True DataControl 8.0
Filters

True DataControl filters can be specified at design time on the Filters property page, or accessed via the FilterExpressions property at run time in the FilterExpressions collection.

Filter expressions restrict the set of records retrieved to the True DataControl recordset. For each fetched record, True DataControl evaluates each filter expression (provided that the accompanying condition expression evaluates to True) and excludes the record from the resulting recordset if the filter expression evaluates to False.

If multiple filter expressions are defined, they work as if they were connected by a logical AND operator.

IMPORTANT: Filter expressions are only evaluated if the Filtered property of the True DataControl is True. To enable filters, check the box labeled Filtered on the General property page or set the Filtered property in code.

If you can’t express your filtering rules as True DataControl expressions, you can use the Filter event. Filter event procedure returning False in its Result argument excludes the record from the resulting recordset. The Filter event also is enabled only if the Filtered property is set to True.

Using filters you must be aware that they can introduce significant performance overhead, since all records are fetched prior to checking the filter expressions. If you can use range conditions or SQL with parameters, these are far more optimized approaches than filters. Use filters only if you can’t restrict the recordset by other means. For more information, see Field Range Conditions and Parameterized SQL.

The FilterExpressions collection consists of FilterExpression items, each of which has the following properties:

FilterExpression

Specifies a Boolean expression that will be evaluated once per record to filter the recordset. If all filter expressions evaluate to True, the record will be included; if a filter expression evaluates to False, the record will be excluded.

ConditionExpression

Specifies an optional Boolean expression that will be evaluated once per record to determine whether the associated filter expression should be evaluated at all. If the condition expression is empty or evaluates to True, the filter expression will be evaluated; if the condition expression evaluates to False, the filter expression will not be evaluated.

Note: Neither expression will be evaluated if the Filtered property of the control is False.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback