Click or drag to resize

DbFilter Function

X#
Return a filter.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbFilter() AS STRING
Request Example 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#
1USE customer INDEX customer NEW
2SET FILTER TO Last = "Smith"
3USE invoices INDEX invoices NEW
4SET FILTER TO CustId = "Smi001"
5SELECT customer
6QOut(DBFilter())
7// Result: Last = "Smith"
8QOut(Invoices->DBFilter())
9// Result: Custid = "Smi001"
See Also