xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DbFilter()

Returns the filter expression of a work area-

Syntax

DbFilter() --> cFilter

Return

The function returns a character string containing the filter expression of a work area, or a null string ("") when no filter is set.

Description

The DbFilter() function can be used to query the filter condition set in a work area as a character string. This allows for temporarily disabling a filter and restore it later using the macro operator (&). Note, however, that this works only if a filter condition does not refer to lexical variables (GLOBAL, LOCAL, STATIC).

By default, DbFilter() operates in the current work area. Use an aliased expression to query filter expressions of different work areas.

Info

See also:DbClearFilter(), DbRelation(), DbRSelect(), DbSetFilter(), SET FILTER
Category: Database functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines a programming technique for saving
// and restoring a filter condition in a work area

   PROCEDURE Main
      LOCAL cFilter

      USE Customer ALIAS CUst SHARED
      INDEX ON Upper(Lastname+Firstname) TO Cust01

      SET FILTER TO Cust->Lastname = "S"
      GO TOP
      ? Cust->Lastname                 // result: Shiller

      ? cFilter := DbFilter()          // result: Cust->Lastname = "S"

      DbClearFilter()

      GO TOP
      ? Cust->Lastname                 // result: Alberts

      SET FILTER TO &cFilter

      GO TOP
      ? Cust->Lastname                 // result: Shiller

      CLOSE Cust
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe