SetFilter

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

SetFilter

Declaration

procedure SetFilter( sExpression: String );

Description

Defines a subset of the current table according to the condition passed as a filter. SetFilter as a method exists for compatibility purposes.

image\tip.gif It is recommended that the Query method be used instead of SetFilter, since SetFilter does not attempt to perform any query optimization whatsoever, whereas the Query method does.

Parameters

sExpression: An xBase expression that will evaluate to a logical True or False.

image\tip.gif To remove a filter pass this parameter as a NULL string ('' or #0).

Logical Operator Precedence

Logical operator precedence is .NOT., .AND., and finally .OR. Query expressions with more than two elements using different logical operators to join the elements must be carefully constructed by observing the precedence rules.

 

See Query for a complete discussion on the rules of filter expression construction.

Delphi Example

// Display customers in China only that have a last name

ApTbl.SetFilter( 'UPPER(TRIM(PLACE))="CHINA" .AND. LEFT(LAST, 1)>" "' );

C++Builder Example

// Display customers in China only that have a last name

ApTbl->SetFilter( "UPPER(TRIM(PLACE))='CHINA' .AND. LEFT(LAST, 1)>' '" );

See Also

DBFilter, SetDeleted, Query