I feel like a real dumb but I am really clueless, a searhed trough many of the codes in navision demo database still couldn't figure it out :roll:
Can anyone explain it to me ???
Hi,
The :: is mostly used to access the Option Values of an Option Field in a Table by using their names.
Internally these a stored as integer values, but the style guide does not allow to use the integers in the code directly ( though this will also work) because the code becomes less readable.
It is also used to access the tables by name and not by their table ID
for instance "DATABASE::Item" instead of "27" , when tables
are used as function parameters.
Options in Navision are stored as integer values. This means if you would have a field with the options Contact,Customer,Vendor these options are stores as 0,1,2. Note that options start at zero!
So if you now want to set a filter on that field it would like like this:
setrange(option, 1)
As you see, this is not quite good to understand. That is way Navision invented the scope!
You can "translate" the (interget) option value to "option::optionvalue"
setrange(option, option::Customer)
But be sure the variable / field is known. If not, refer to the right table. See below...
Say can you give some details on this style guide please ?
The style guide consists of several documents which determine how code, tables, forms and everything else in Navision should be designed in order to maintain the proper "look-and-feel" throughout the application. #-o
Another question about "::", because I'd like to get value to option string.
So the Input is a String what is IN(!) the target option field's value.
(GETFILTER(Type))
How can get this value for the option field?
Because I don't like to generate a case function, if its this than do this...
I'd like to get the simple value for the option field.
Type := Type::GETFILTER(Type) or similar this. But this is not works of course.
Comments
The :: is mostly used to access the Option Values of an Option Field in a Table by using their names.
Internally these a stored as integer values, but the style guide does not allow to use the integers in the code directly ( though this will also work) because the code becomes less readable.
It is also used to access the tables by name and not by their table ID
for instance "DATABASE::Item" instead of "27" , when tables
are used as function parameters.
For example, take Table 36-Sales Header
Field Document Type.
In your code, when you want to know wich type of Sales Header you have, you can write :
IF "Document Type" = "Document Type"::Order THEN ...
It's the same as :
IF "Document Type" = 2
but it's more readable ...
Options in Navision are stored as integer values. This means if you would have a field with the options Contact,Customer,Vendor these options are stores as 0,1,2. Note that options start at zero!
So if you now want to set a filter on that field it would like like this:
As you see, this is not quite good to understand. That is way Navision invented the scope!
You can "translate" the (interget) option value to "option::optionvalue"
But be sure the variable / field is known. If not, refer to the right table. See below...
If it was hard to write, it should be hard to understand."
Say can you give some details on this style guide please ?
The style guide consists of several documents which determine how code, tables, forms and everything else in Navision should be designed in order to maintain the proper "look-and-feel" throughout the application. #-o
Another question about "::", because I'd like to get value to option string.
So the Input is a String what is IN(!) the target option field's value.
(GETFILTER(Type))
How can get this value for the option field?
Because I don't like to generate a case function, if its this than do this...
I'd like to get the simple value for the option field.
Type := Type::GETFILTER(Type) or similar this. But this is not works of course.
Thank you!
A
Answer: try this (if you have just one-value filter):
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I know this thread was dead, but I don't want to open a new thread because the topic is same
I tried this and works! Thanks again
A