Click or drag to resize

DbFilter Function

Return a filter.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.7
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.
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 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.
This example opens two database files, sets two filters, then displays the filter expressions for both work areas:
1USE customer INDEX customer NEW
2SET FILTER TO Last = "Smith"
3USE invoices INDEX invoices NEW
4SET FILTER TO CustId = "Smi001"
5SELECT customer
7// Result: Last = "Smith"
9// Result: Custid = "Smi001"
See Also