Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>dbfilter()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DBFILTER()
 Return the current filter expression as a character string
------------------------------------------------------------------------------
 Syntax

     DBFILTER() --> cFilter

 Returns

     DBFILTER() returns the filter condition defined in the current work area
     as a character string.  If no FILTER has been SET, DBFILTER() returns a
     null string ("").

 Description

     DBFILTER() is a database function used to save and re-execute an active
     filter by returning the filter expression as a character string that can
     be later recompiled and executed using the macro operator (&).  This
     function operates like the DBRELATION() and DBRSELECT() functions which
     save and re-execute the linking expression of a relation within a work
     area.

     Since each work area can have an active filter, DBFILTER() can return
     the filter expression of any work area.  This is done by referring to
     DBFILTER() within an aliased expression as demonstrated below.

 Notes

     .  Declared variables: A character string returned by DBFILTER()
        may not operate correctly when recompiled and executed using the
        macro operator (&) if the original filter expression contained
        references to local or static variables, or otherwise depended on
        compile-time declarations.

 Examples

     .  This example opens two database files, sets two filters, and
        then displays the filter expressions for both work areas:

        USE Customer INDEX Customer NEW
        SET FILTER TO Last = "Smith"
        USE Invoices INDEX Invoices NEW
        SET FILTER TO CustId = "Smi001"
        SELECT Customer
        //
        ? DBFILTER()                      // Result: Last = "Smith"
        ? Invoices->(DBFILTER())      // Result: Custid = "Smi001"

     .  This user-defined function, CreateQry(), uses DBFILTER() to
        create a memory file containing the current filter expression in the
        private variable cFilter:

        FUNCTION CreateQry( cQryName )
           PRIVATE cFilter := DBFILTER()
           SAVE ALL LIKE cFilter TO (cQryName + ".qwy")
           RETURN NIL

     .  You can later RESTORE a query file with this user-defined
        function, SetFilter():

        FUNCTION SetFilter()
        PARAMETER cQryName
           RESTORE FROM &cQryName..qwy ADDITIVE
           SET FILTER TO &cFilter.
           RETURN NIL

 Files   Library is CLIPPER.LIB.


See Also: DBRELATION() DBRSELECT() SET FILTER

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