Assign an option field value

Hello All,
i have a field type option where i want to assign the options like
Option 1 -> 0,0 - 1,0
Option 2 -> 0,0 - 2,0
and so on. How can i do it on NAV 16 and above

Answers

  • edoderooedoderoo Member Posts: 76
    I could add quotes (single or double) around the options, but that didn't really help.
    To replace the comma with a dot as "decimal separator" worked better. Will that do for you?
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • RahilaRahila Member Posts: 16
    @edoderoo thanks for the reply , my requirement is this i cannot replace them by decimal separator :( i have to use the way it is
  • edoderooedoderoo Member Posts: 76
    In the properties of the option field you can enter something like 1,2,3,4,5 as OptionString, and use the OptionCaption to hold '0,0 - 1,0','0,0 - 2,0' or "0,0 - 1,0","0,0 - 2,0"

    The option string can also be something like 'zero to one','zero to two' if you want to make them more descriptive, but the user will see the Captions on the screen.

    Will that do?
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • RahilaRahila Member Posts: 16
    Thishxm6sporz17c.png
  • RahilaRahila Member Posts: 16
    @edoderoo the above picture is what desired
  • edoderooedoderoo Member Posts: 76
    That should be possible with OptionCaption, only option 0,75–0,0 is twice in the list, and all captions must be unique. But with 0,75-0,0 and 0,75–0,0 that can be done too (one is a hyphen, the other a long hypen).
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • RahilaRahila Member Posts: 16
    @edoderoo just ignore the same ones, i want it for the rest of it, I cannot do it in optionstring as it gives me error
  • edoderooedoderoo Member Posts: 76
    the option-string is what you as a developer see in the code. The option-caption is what the user will see on the screen. Make the option-string something like 1,2,3,4,5,6,7,8 and use the caption to make it sensible values.
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • RahilaRahila Member Posts: 16
    @edoderoo that's what i am saying. I have tried in both captions as well as in option string i get error
  • edoderooedoderoo Member Posts: 76
    Maybe it's a NAV16 thing... I tried it on NAV17, I do not have a NAV16 anymore. Maybe someone else will come along with NAV16 that can help you out...
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • vaprogvaprog Member Posts: 955
    I am not aware of any way to quote a comma in an OptionCaption value. That means it is impossible to have a comma as part of a caption of an option value.
    That's true even for NAV 2017.
    @edoderoo What did you do that worked for you?
  • edoderooedoderoo Member Posts: 76
    edited 2020-01-18
    I used "one,1","two,2","three,3" and that compiled nice. But I didn't run the results, now I see at runtime NAV is making it 5 options (the last one is even missing). For me, this is a bug.
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
Sign In or Register to comment.