Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - set filter to insert or remove an item in the filter list http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 set filter to       Insert or remove an item in the filter list
------------------------------------------------------------------------------
 Syntax
   [!sAlias] set filter to [lExp [additive]]

 Arguments
   sAlias is the database to operate on.
   lExp is a logical expression.

 Description
   The set filter to command inserts or removes an expression from the filter
   list.

   After the record pointer has been repositioned, the database engine
   checks the validity of the set filter to expression. If lExp is .f.,
   then the record pointer is repositioned. This process continues until
   lExp is .t. or until EOF or BOF is .t..

   If lExp is specified, then skip, go top or go bottom checks the
   result of lExp before setting the record number. If the result of
   lExp is .f., then each command will skip through the alias in the
   appropriate direction until lExp is .t..

   If lExp is not specified, then all filters in the filter list are
   removed from the alias. This is identical to encoding:

   set filter to .t.

   The additive clause tells the Force compiler to add lExp to the filter
   list of expressions that must evaluate to .t. for a record to be in the
   logical database. If additive is not specified, then lExp becomes the
   only filter in the filter list.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc ListRecords static
   go top
   do while .not. eof()
      ? recno(), sTest->firstname, sTest->lastname
      skip
   enddo
   wait
   endproc
   
   proc Test_setfilterto
   open sTest
   set filter to sTest->lastname = "Canady"        // first filter
   ListRecords()
   set filter to sTest->lastname = "Vanderbilt"    // replaces first filter
   ListRecords()
   set filter to sTest->firstname = "Amy" additive // additional condition
   ListRecords()
   endproc

   proc main
   Test_setfilterto()
   endproc

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