C5_DBFILTER

 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



One response to “C5_DBFILTER

  1. Pingback: C5_SET FILTER | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.