Function which return 'Is not an option'

JedrzejT
JedrzejT Member Posts: 267
Hello All

Where is a function which return this Error ?

"Is not an option 'something'"
"The existing options are : "
" 'something,,,'


by the way

Is Navisin store all optionstrings of all field in database in table?


Sorry for my english ;)

Comments

  • kine
    kine Member Posts: 12,562
    It can be line like:
    SalesLine.SETRANGE("Document type",'Order'); 
    

    When you run this code under another language.

    Correct form>
    SalesLine.SETRANGE("Document type",SalesLine."Document type"::"Order"); 
    

    The options are not in table, but can be get through RecordRef and FieldRef.OPTIONSTRING...
    GetOptionValues(Tab : Integer;Field : Integer) : Text[200]
    var
      RecRef: RecordRef;
      FRef: FieldRef;
    begin
      RecRef.OPEN(Tab);
      FRef := RecRef.FIELD(Field);
      OptVal := FRef.OPTIONSTRING;
      RecRef.CLOSE;
      EXIT(OptVal);
    end;
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JedrzejT
    JedrzejT Member Posts: 267
    Thanks

    I know how take the optionstring by fldref

    I'd like to take advantage of this function (if exists) to check that option is correct for optionstring of field.

    I have table

    TblID | FldIf | Value |

    User lookup table and field, Then enter value.

    If field is type:option i want check is this entry correct for this optionstring

    The best if I could make from it DrillDown and select option, but this is probably impossible.
  • kine
    kine Member Posts: 12,562
      "Field Type"::Option: BEGIN
          OptNo := STRMENU(GetOptionValues("Base Table","Field No."),1);
          NewVal := SELECTSTR(OptNo,"Option Values");
        END;
    

    What about this code?? I am using it for users to select the option...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JedrzejT
    JedrzejT Member Posts: 267
    Thanks

    I would run on it long time...

    If you have a Solution to create a lookup on this field "Value" your a champion :)

    I read on this forum today that is not possible

    i try it

    recref,OPEN(Table."Tabled id")
    Fldref=recref.FIELD("Field ID")
    IF FORM .RUNMODAL(0,FldRef.RELATION)=ACTION::LookupOK THEN

    Thanks again
  • DenSter
    DenSter Member Posts: 8,307
    By adding an option field to a form, Navision will put the field into a dropdown list control, and from there you can only enter valid values.
  • kine
    kine Member Posts: 12,562
    Yes, but not in situation, when you are using recordref and fieldref and want to select options for different fields...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.