FILTER( ) Function

JavaScript Editor js editor     Web development 



Main Page

Returns the table filter expression specified in SET FILTER.

FILTER([nWorkArea | cTableAlias])

Parameters

nWorkArea


Specifies the work area of the table for which FILTER(В ) returns the filter expression. FILTER(В ) returns the empty string if a table isn't open in the work area you specify.
cTableAlias


Specifies the alias of the table for which FILTER(В ) returns the filter expression. Visual FoxPro generates an error message if you specify a table alias that doesn't exist.

Return Value

Character

Remarks

If you omit the optional arguments, FILTER(В ) returns the filter expression for the table open in the currently selected work area. For more information about creating a filter, see SET FILTER.

Example

В Copy Code
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table
SET TALK ON
SET FILTER TO SUBSTR(cust_id,1) = 'B'

CLEAR
? FILTER( )  && Display filter expression
STORE FILTER('customer') TO gcOldFilter    && Save filter expression
SET FILTER TO country = 'USA'
? FILTER( )  && Display filter expression
SET FILTER TO &gcOldFilter    && Restore filter expression
? FILTER( )  && Display filter expression

LIST FIELDS cust_id, contact  && Demonstrate filter condition

See Also



JavaScript Editor js editor     Web development