Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mach SIx v1.1c - Reference Guide - <b>set filter - hide records not meeting a condition</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SET FILTER       - Hide records not meeting a condition
-------------------------------------------------------------------------------

  Syntax

  SET FILTER TO [<lCondition>] [NOOPTIMIZE]

  Arguments

  <lCondition> is a logical expression that defines a specific set of
  current work area records accessible for processing.

  NOOPTIMIZE, preempts optimization and forces default Clipper processing.

  SET FILTER TO without an argument deactivates the filter condition.

  Description:

  When a FILTER condition is SET, the current work area acts as if it
  contains only the records that match the specified condition.  A filter
  condition is one of the properties of a work area.  Once a FILTER has
  been SET, the condition can be returned as a character string using the
  DBFILTER() function.

  Most commands and functions that move the record pointer honor the
  current filter with the exception of those commands that access records
  by record number.  This includes GOTO, commands specified with the
  RECORD clause, and RELATIONs linked by numeric expression to a work
  area with no active index.

  Once a FILTER is SET, it is not activated until the record pointer is
  moved from its current position.  You can use GO TOP to activate it.

  As with SET DELETED, a filter has no effect on INDEX and REINDEX.
  SUBINDEX will respect a filter.

  SET ORDER TO 0.  Because Mach SIx internally caches filtered records
  in natural record order optimal filter performance will be achieved with
  SET ORDER TO 0.

  -----------------------------------------------------------------------
  Note:  Non-optimizable filters

  Although SET FILTER makes the current work area appear as if it
  contains a subset of records, it in fact processes all records in the
  work area sequentially.  Because of this, the time required to process
  a filtered work area will be the same as an unfiltered work area.
  -----------------------------------------------------------------------

  ---------------------------------| EXAMPLE |--------------------------------
  /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  *  Demonstrates the SET FILTER command                                    *
  *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/

  //.................................open Account database ( 10,000 records )
  USE Account VIA "DBFSIX"

  //..........open indexes: Age and State could also be a tags in a .CDX file
  SET INDEX TO Age, State

  //.............................set order to 0 for optimal filter performance
  SET ORDER TO 0

  SET FILTER TO  Age > 25 .AND. Age < 30 .AND. State = "CA"

  //.................check filter optimization level, see also m6_IsOptimize()
  ? "Filter optimization = "
  ??  m6_IsFilter()           // 2

  //......................................................activate the filter
  GO TOP

  // Check the number of records in the filter. This number will be exactly
  // equal to the number of filtered records if the filter condition is fully
  // optimizable and DELETED is OFF ( or if DELETED is ON and deleted records
  // have been eliminated with an active index built on DELETED() ).

  ? "Number of indexed records in filter = "
  ?? m6_RecCount()            // 55

  //...................................................view filtered records
  Browse()


See Also: m6_IsFilter() REFRESH FILTER

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson