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);
Question
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
Solution 2
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);
OTHER TIPS
Should you still wish to convert a string to an option value, EVALUATE is the way to go! :)
// 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;