SETRANGE for Option type field

gumwitka
Member Posts: 34
Hi,
does anyone knows if I can use SETRANGE for fields that have option type?
Could you give me an example how to use it?
Kasia
does anyone knows if I can use SETRANGE for fields that have option type?
Could you give me an example how to use it?
Kasia
0
Comments
-
Hi
example:
vendor.SETRANGE(vendor."Application Method",vendor."Application Method"::"Manual");0 -
it does not work this way0
-
this example should and must work
Maybe there is other error. What do you trying to do?0 -
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.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.0
-
Mbad wrote: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.0 -
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, ...).0
-
jjanauskas wrote: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...0 -
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 specification0
-
jjanauskas wrote: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...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions