As JedrzejT said it should work. You can also set a range like this
SalesHeader.SETRANGE("Document Type",SalesHeader."Document Type"::Order,SalesHeader."Document Type"::Invoice) or you can use the integer representation of the options like this
SalesHeader.SETRANGE("Document Type",1,2).Note that options start from 0.
Abstain from using the number representation of the option unless its absolutely necessary(ie in variables used for multiple purposes). It conflicts with navision naming policy.
Abstain from using the number representation of the option unless its absolutely necessary(ie in variables used for multiple purposes). It conflicts with navision naming policy.
Though, it is still represented as number.
for example,
you write SalesHeader."Document Type"::Order and "Order" is in position "3"
in OptionString.
If you add another option to the list with smaller position number (after wich, your "Order" option will be on position 4),
your code will be "renamed" to option with position number 3.
btw, in standart navision code they never (or at least I don't remember) use SETRANGE for filtering several values of option field. They always use SetFilter(Field, '%1|%2|...', opt1, opt2, ...).
btw, in standart navision code they never (or at least I don't remember) use SETRANGE for filtering several values of option field. They always use SetFilter(Field, '%1|%2|...', opt1, opt2, ...).
afaik, SETRANGE is for to set a "range" of values.
wich means either "a" or ("a".."b")
SETFILTER is used for advanced filtering with boolean operators, brackets etc...
Phenno, you are absolutely right, but in case when you want to filter the option field by range from opt1 to opt2, in standard navision they still enumerate all option values using SETFILTER, thus avoiding range specification
Phenno, you are absolutely right, but in case when you want to filter the option field by range from opt1 to opt2, in standard navision they still enumerate all option values using SETFILTER, thus avoiding range specification
Probably cause of that "naming conventions"... if someone looks at the code, he/she probably don't know what options resides between opt1 & opt2...
Comments
example:
vendor.SETRANGE(vendor."Application Method",vendor."Application Method"::"Manual");
Maybe there is other error. What do you trying to do?
SalesHeader.SETRANGE("Document Type",SalesHeader."Document Type"::Order,SalesHeader."Document Type"::Invoice) or you can use the integer representation of the options like this
SalesHeader.SETRANGE("Document Type",1,2).Note that options start from 0.
Though, it is still represented as number.
for example,
you write SalesHeader."Document Type"::Order and "Order" is in position "3"
in OptionString.
If you add another option to the list with smaller position number (after wich, your "Order" option will be on position 4),
your code will be "renamed" to option with position number 3.
http://navisionfreak.blogspot.com/
Justas Janauskas
afaik, SETRANGE is for to set a "range" of values.
wich means either "a" or ("a".."b")
SETFILTER is used for advanced filtering with boolean operators, brackets etc...
http://navisionfreak.blogspot.com/
Justas Janauskas
Probably cause of that "naming conventions"... if someone looks at the code, he/she probably don't know what options resides between opt1 & opt2...