2

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

Florian
  • 1,827
  • 4
  • 30
  • 62

3 Answers3

6

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

Jan Hoek
  • 702
  • 5
  • 13
1

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);

Florian
  • 1,827
  • 4
  • 30
  • 62
  • 1
    Yup, Option variables are just enums (http://en.wikipedia.org/wiki/Enumerated_type). Don't forget the quotes around option values with spaces in them :) – Jake Edwards Nov 14 '12 at 21:33
0
// 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;
George G
  • 106
  • 7