Assigns a filter to a field that you specify.
|
Record.SETFILTER(Field, String, [Value],...)
|
Parameters
- Record
-
Type: Record
The record that contains the field that you want to filter.
- Field
-
Type: Field
The field that you want to filter.
- String
-
Type: Text or code
The filter expression. A valid expression consists of
alphanumeric characters and one or more of the following operators:
<, >, *, &, |, and =. You can use replacement fields (%1,
%2, and so on) to insert values at run-time.
- Value
-
Type: Any
Replacement values to insert in replacement fields in the filter
expression. The data type of Value
must match the data type of Field.
Remarks
Example
The following table shows examples of filters.
Filter |
Description |
A..Z
|
A range from A to Z
|
A|G
|
A or G
|
F.. & *A/S
|
A range from F and A/S is included in the field
|
<>B
|
All except B
|
<>''
|
All not blank
|
<=200 | >500
|
All less than or equal to 200 or greater than 500
|
The following code examples show how to use the
SETFILTER function.
This example requires that you create the following
variable.
Name |
DataType |
Subtype |
GLAccountRec
|
Record
|
G/L Account
|
|
Copy Code |
// Using a filter with replacement field.
// This filter selects all accounts in the range from 100 to 200
// and No. 300.
GLAccountRec.SETFILTER("No.", '%1..%2|%3', '100', '200', '300');
// Using a filter entered directly in a string.
// This filter, which is entered as a string, has the same result as
// the previous example.
// This filter selects all accounts in the range from 100 to 200 and
// and No. 300.
GLAccountRec.SETFILTER("No.", '100..200|300');
|
See Also