[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Return the current filter expression as a character string

     DBFILTER() --> cFilter


     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 ("").


     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

     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.


     .  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.


     .  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.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson