New Option String

MalhodyMalhody Member Posts: 14
Hey Guys,

im really new in programming in navision and i've a short question:

I've an option field Not. Code with 3 possibilities:
OptionString:Customer,Vendor,Production

this field is located in a few other tables.
and now i want to add a ' ' string at the first position:
OptionString: ,Customer,Vendor,Production

I think navision don't use the option string, but instead uses the corresponsible number.

Report Example:
IF Not. Code = Not. Code::Customer THEN......

In my opinion navision looks for Not. Code::0 what means Not. Code::'' after adding the string...

i'm right???


i hope you understand what i mean :D

thank u very much

Comments

  • AlbertvhAlbertvh Member Posts: 516
    Hi
    I would advise not to put it as the first option as this will be 0 and all your othe options are moved up by 1 rather set your option to the end

    eg. Customer,Vendor,Production,,,,,space

    space here means a blank as you will not see it otherwise

    the extra commas are to avoid clashing in an upgrade if new options are added in the upgrades.

    You could also write a processing report that will add 1 to the option field but remember to do that everywhere that this option string is used.


    Albert
  • Revolution1210Revolution1210 Member Posts: 161
    When coding, you can either write you code like this:
    IF Test = Test::"0" THEN;
    IF Not. Code  = Not. Code ::"1" THEN;
    IF Not. Code  = Not. Code ::"2" THEN;
    IF Not. Code  = Not. Code ::"3" THEN;
    

    or this....
    IF Not. Code  = Not. Code ::" " THEN;
    IF Not. Code  = Not. Code ::Customer THEN;
    IF Not. Code  = Not. Code ::Vendor THEN;
    IF Not. Code  = Not. Code ::Production THEN;
    

    If you write as in the first example, NAV will replace with the textual representation of the options string when you save then reopen the object.
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • kinekine Member Posts: 12,562
    Malhody wrote:
    Hey Guys,

    im really new in programming in navision and i've a short question:

    I've an option field Not. Code with 3 possibilities:
    OptionString:Customer,Vendor,Production

    this field is located in a few other tables.
    and now i want to add a ' ' string at the first position:
    OptionString: ,Customer,Vendor,Production

    I think navision don't use the option string, but instead uses the corresponsible number.

    Report Example:
    IF Not. Code = Not. Code::Customer THEN......

    In my opinion navision looks for Not. Code::0 what means Not. Code::'' after adding the string...

    i'm right???


    i hope you understand what i mean :D

    thank u very much

    Yes, you are right. If you "insert" new value into the string, nav will shift all meanings of the options in the code (integer representation will stay same, but the value will means something other than...). There is one solution. Export all objects as text, change the option string definition in the text file, import it back, compile. In this case, NAV will use the option Name to find correct integer value and there will be no problem in the code. Of course, already saved values in the table will be wrong...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.