SETFILTER function

SETFILTER is similar to, but much more flexible than, the SETRANGE function because it supports the application of any of the supported NAV filter functions to table fields. SETFILTER syntax is as follows:

Record.SETFILTER(FieldName, FilterExpression [Value],...);

The FilterExpression consists of a string (Text or Code) in standard NAV filter format, including any of the operators < > * & | = in any legal combination. Replacement fields (%1, %2, ..., %9) are used to represent the values that will be inserted into the FilterExpression by the compiler to create an operating filter formatted as though it were entered from the keyboard. Just as with SETRANGE, prior to applying its filter, the SETFILTER function clears any filters that were previously set for the defined field, for example:

  • Filter to get only Items with a No. from 1300 through 1400:
        Item.SETFILTER("No.",'%1..%2','1300','1400'),
  • Or with any of the variable values of LowVal or MedVal or HiVal:
        Item.SETFILTER"No.",'%1|%2|%3',LowVal,MedVal,HiVal);

In order to be effective in a Query, SETFILTER must be called before the OPEN, SAVEASXML, and SAVEASCSV functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.247.31