Click or drag to resize

DbServer.SetFilter Method

X#
Set a filter condition.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD SetFilter(
	cbFilterBlock,
	cFilterText
) AS USUAL CLIPPER
Request Example View Source

Parameters

cbFilterBlock (Optional)
Type: Usual
The code block that expresses the filter condition in executable form. If the code block is omitted, the string version of the filter expression is macro-compiled into a code block.
cFilterText (Optional)
Type: Usual
The filter condition. If omitted, the DBServer:Filter access method returns a NULL_STRING.

Return Value

Type: Usual
TRUE if successful; otherwise, FALSE.
Remarks
Both arguments specify the filter expression, one in the form of a code block, one in the form of a string. Both arguments are optional, but at least one must be provided. The reason for specifying both versions is that a compiled code block is faster, while the string version can be reported back through the Filter access method. Obviously, if both forms are specified, they should define the same expression.
Examples
The following examples demonstrate the various methods of setting a filter using the DBServer:SetFilter(). The filter condition is customer numbers (CustNo) exceeding 20,000. Note the user of the GoTop() method to invoke the filter expression by moving the record pointer.
X#
 1// Codeblock specified only
 2oDBCust:SetFilter({||CustNo > 20000})
 3oDBCust:GoTop()
 4// Codeblock and text to describe the filter text specified
 5oDBCust:SetFilter({||CustNo > 20000}, "CustNo > 20000")
 6oDBCust:GoTop()
 7// Filter text specified only, which is compiled into a code block
 8oDBCust:SetFilter(, "CustNo > 20000")
 9oDBCust:GoTop()
10// Filter text specified only, which is compiled into a code block
11oDBCust:SetFilter(, [ Gender = '] + SELF:cGender + ['] )
12oDBCust:GoTop()
See Also