setrange and setfilter

Hi all,

Please explain me setrange and setfilter functions of c/al with example.




Use this function to set a simple filter, such as a single range or a single value, on a field.

Whereas SETFILTER can have various operators like >, <, <> etc. :

This operator…






Less than


Less than or equal to


Greater than


Greater than or equal to


Different from


Forms a part of value

I believe F1 (Online help) has explained both functions well. If still you have any doubt, please post it here

Hi ,

I am very new to navision and i am learning nav2009 C/al please explain with example (setrange and setfilter functions )




Lets say you are interested in Customer table’s those record having No. value in between 1000 and 2000 then you can write following:

Customer.SETRANGE(“No.”,1000, 2000); // Rec.SETRANGE(FieldName, LowerRange, UpperRange)

The limitation of SETRANGE is that you can not define the operators here, just linited to minimum and maximum values, whereas in case of SETFILTER you can define various operators.

For example, if you are interested in all values other than 2000 then

Customer.SETFILTER(“No.”,’<>%1’,2000);// all values other than 2000

Customer.SETFILTER(“No.”,’>%1’,2000); //all values greater than 2000

Customer.SETFILTER(“No.”,’<%1’,2000); //all values less than 200


<=200 | >500


All less than or equal to 200 or greater than 500

| - | - |