Dear All,
Please tell me ,how can i retrieve Option Value from a Variable of Type Option.?
I got the integer values corresponding to my optionstring but i don’t know how to retrieve its String …!!
Please help me[:O]
Rose
Dear All,
Please tell me ,how can i retrieve Option Value from a Variable of Type Option.?
I got the integer values corresponding to my optionstring but i don’t know how to retrieve its String …!!
Please help me[:O]
Rose
Hi, this is in fact an impossible thing when you try it directly.
You have two different options to make this happen:
Create a comma seperated string for each language and assign it to a text constant.
Then you can retrieve the string you are interested in by using the following:
Text := SELECTSTR(MyOptionValue+1, TEXTCONSTANT);
If the options you are using match any option field in any table, you can try the following:
TableVar.OptionField := MyOptionValue;
Text := STRSUBSTNO(’%1’, TableVar.OptionField);
best regards
Thomas
Hi,
Another option is to use a FieldRef variable e.g.
lvFieldRef := lvRecRef.FIELD(1);
OptionString := lvFieldRef.OPTIONCAPTION;
Dear Rose,
If you don’t care about the language(caption) then the easiest way to do it is here:
“Document Type” := 1;
MESSAGE(FORMAT(“Document Type”));
“Document Type” is your option. First I set it to value 1 (order) and then I just use FORMAT, which converts to a string value.
What do you mean directly impossible?
MyTextVariable := FORMAT(MyOptionVariable);
Is that not direct enough?
like Erik said there
Could you please just tell us what you are trying to do? From all the option questions you’ve been posting I’d say that you are trying to write C/AL code directly translated from how you would deal with a dropdownlist in VBA or something, and I think this is not the right way to solve your problem. It’s nice to learn about all the syntax, and it looks really cool to have large chunks of “VB-looking” C/AL code, but many times there is a much more efficient way to accomplish these thigns in very simple NAV terms.
Why don’t you tell us what the requirement is, what it is that you are trying to accomplish, so we can maybe help you come up with a more “NAV friendly” way to write the code.