Validate in Option

sabzamsabzam Member Posts: 1,149
I am inserting a new record; and one of the fields is an option field. Let's say I need to insert type 'G/L Account' or Customer depending on the case.

How can I do this by passing over a text variable and sort of changing it into an option?

Comments

  • NaviDevNaviDev Member Posts: 365
    U can use the STRMENU.
    Navision noob....
  • sabzamsabzam Member Posts: 1,149
    I am trying to do as follows:

    Validate ("Account Type", StrMenu ("Account Type", 1));

    and

    Validate ("Account Type", StrMenu ("Account Type", Type));

    but none is working
  • BBlueBBlue Member Posts: 90
    You can try this way:
    Validate("Account Type","Account Type"::"G/L Account");
    Validate("Account Type","Account Type"::Customer);
    
    //Bogdan
  • sabzamsabzam Member Posts: 1,149
    Hi BBlue,

    I usually used the way you mentioned above. What I am trying to do is to Have G/L Account and Customer passed over by Variable
  • NaviDevNaviDev Member Posts: 365
    sabzam wrote:
    I am trying to do as follows:

    Validate ("Account Type", StrMenu ("Account Type", 1));

    and

    Validate ("Account Type", StrMenu ("Account Type", Type));

    but none is working


    Try using this one instead.
    textVar := 'Option 1,Option 2,Option 3';
    Validate ("Account Type", STRMENU(textVar, 1));
    
    Navision noob....
  • DenSterDenSter Member Posts: 8,305
    You can create an option type variable. The tricky part though is to make sure that they have the same option values as the field you are populating.
Sign In or Register to comment.