FILTER

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

FILTER

The form of the FILTER command is one of the following:

FILTER svar/bit,

FILTER mvar/bit,

FILTER col/bit,

FILTER OFF,

The FILTER command can be used to filter the definition of variables on some condition, down to the next FILTER command. It can also be used to filter selected records to the tables following, down to the next FILTER command. A GLOBAL BT# is automatically set for the tables that have been filtered unless the filter variable is a col.

The effect is that of an UL command followed by a GO TO. Thus:

filter $age/1,

will cause all records where $AGE does not have value 1 to jump to the next FILTER command. This is equivalent to:

unless $age/1, go to @next,

where @NEXT is the position of the next FILTER. A special form of the command:

filter off,

can be used as a destination to catch all records at the end of filtering.

If the filter variable is an svar or an mvar and a FL, V or X text is set for it, then the FILTER command sets the GLOBAL BT to the text from the appropriate bit in the variable. FILTER OFF has the effect of setting off the GLOBAL BT#. If no FL, V or X text is set, the GLOBAL BT# will not be set. This setting of the GLOBAL BT# may be overridden.

NOTE: the FILTER OFF unsets (turns off) the global BT, it does not restore it to the value before the filter command.

This feature is useful in loops, to generate "multi-dimensional" tables.

Examples of FILTER commands:

filter $q1a/17,

filter off,