Florian
Florian

Reputation: 1887

Navision How to Convert a Text to Option

I have a text variable which I want to convert into a option and set table data with it. How do it convert the variable into a option?

Thanks

Upvotes: 2

Views: 12207

Answers (3)

George G
George G

Reputation: 126

// Option to text:

optionName := format(salesHeader."Document Type"::Order);


// Text to option:

case (optionName) of
  'Order': salesHeader."Document Type" := salesHeader."Document Type"::Order;
  'Invoice': salesHeader."Document Type" := salesHeader."Document Type"::Invoice;
end;

Upvotes: 0

Jan Hoek
Jan Hoek

Reputation: 712

Should you still wish to convert a string to an option value, EVALUATE is the way to go! :)

Upvotes: 6

Florian
Florian

Reputation: 1887

Solved,

    OptionName := OptionName::Option;

This does not solve the question itself, but is a workaround since "Option" can be a text String (But it must be a predefined one);

Upvotes: 1

Related Questions