Assigns a filter to a field that you specify.

Record.SETFILTER(Field, String, [Value],...)



Type: RecordThe record that contains the field that you want to filter.

Type: FieldThe field that you want to filter.

Type: Text or codeThe 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.

Type: AnyReplacement values to insert in replacement fields in the filter expression. The data type of Value must match the data type of Field.


If the function is called with a field for which a filter already exists, that filter will be removed before the new one is set. You can construct filters using the following operators:

  • ..   Range
  • &   And
  • |   Or
  • <   Less than
  • <=   Less than or equal to
  • >   Greater than
  • >=   Greater than or equal to
  • <>   Different from
  • *   Forms a part of value
  • @   Case-insensitive


The following table shows examples of filters.

Filter Description


A range from A to Z


A or G

F.. & *A/S

A range from F and A/S is included in the field


All except B


All not blank

<=200 | >500

All less than or equal to 200 or greater than 500

This example requires that you create the following variable.

Name DataType Subtype



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


Record Data Type