Option Field

HanenHanen Member Posts: 281
Hi,

I have an option field and I want to get something like this:

if (option = option::red) then index:=1
if (option = option::black) then index:=2
if (option = option::yellow) then index:=3
......
without having to do this with an if ...then

thanks for help!!!
Regards

Hanen TALBI

Comments

  • SLF25SLF25 Member Posts: 37
    Read w1w1adg.pdf document from Navision install CD.
  • HanenHanen Member Posts: 281
    I don't have this document :oops: :cry:
    Regards

    Hanen TALBI
  • SLF25SLF25 Member Posts: 37
    google it :)
  • KYDutchieKYDutchie Member Posts: 345
    [-X no, you have to Bing it :lol:
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • HanenHanen Member Posts: 281
    I got it :) but I can't find how, any help????
    Regards

    Hanen TALBI
  • SLF25SLF25 Member Posts: 37
    Just in CASE you didn't understand, seek and you shall find :lol:
  • SavatageSavatage Member Posts: 7,142
    look for "case statement"

    there's a NAV CAL Programming Guide.pdf
    here: http://www.microsoft.com/downloads/deta ... layLang=en

    See page 14 for case examples
    CASE MyOption OF 
      MyOption::Red: 
        Index := 1; 
      MyOption::Black: 
        Index := 2; 
      MyOption::Yellow: 
        Index := 3; 
    END;
    
  • kinekine Member Posts: 12,562
    If you want the index right in the order of the options, you can use this:
    index:= option +1; //Option is zer-based
    

    But of course do not forget about drawbacks like that if someone change the order etc...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • HanenHanen Member Posts: 281
    Thank you soooooo much :thumbsup: =D>
    Regards

    Hanen TALBI
Sign In or Register to comment.