Click or drag to resize

DbFilter Function

Return a filter.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION DbFilter() AS STRING
View Source

Return Value

Type: String
The filter condition defined in a work area.  If no filter has been set, DBFilter() returns a NULL_STRING.
Remarks
DBFilter() is a database function used to save and re-execute an active filter by returning the filter expression as a string. By default, this function operates on the currently selected work area.   It can be made to operate on an unselected work area by specifying it within an aliased expression or by calling the overload that accepts a workarea parameter (a workarea number or alias ). This function operates like the DBRelation() and DBRSelect() functions, which save and re-execute the linking expression of a relation within a work area.
Tip Tip
Declared variables: A string returned by DBFilter() cannot operate correctly when recompiled and executed using the macro operator (&) if the original filter expression contained references to local or static variables or is otherwise dependent on compile-time declarations.
Examples
This example opens two database files, sets two filters, then displays the filter expressions for both work areas:
X#
USE customer INDEX customer NEW
SET FILTER TO Last = "Smith"
USE invoices INDEX invoices NEW
SET FILTER TO CustId = "Smi001"
SELECT customer
QOut(DBFilter())
// Result: Last = "Smith"
QOut(Invoices->DBFilter())
// Result: Custid = "Smi001"
See Also