Evaluate Option Datatype

How do you use the Evaluate function to turn a text variable into an option variable. Please don’t say: Evaluate(optionvariable,string); This only works if String is a number. If string is a word (the option string) then it doesn’t work.

hi Option Variables are treated as numbers interanally. i think u can get the integer value of the option string. and then use a case or IF statement. harikesh

Jason, Try using FORMAT. e.g stringvariable := 'The value is ’ + FORMAT(optionvariable)

Guess none of the above will work, as Jason wants to turn a text variable into an option. Unfortunately this isn’t easy. Guess it will take some hardcoding! CASE myTxtOptionVariable OF 'option1' : myOptionVariable := myOptionVariable::Option1; 'option2' : myOptionVariable := myOptionVariable::Option2; ELSE myOptionVariable := myOptionVariable::Option3; or at least doing some translation: IF translation.GET(myTxtOptionVariable) THEN myOptionValue := tranlation."Option No."; where you have the table with fields: Option Value, Option No.

This should do the job: integer = -1; repeat integer += 1; optionfield := integer; until format(optionfield) = string; But if the string doesn’t exist as an option value, you get a overflow. Alex