我有一个文本变量,我想将其转换为一个选项并用它设置表数据。它如何将变量转换为选项?
谢谢
如果您仍希望将字符串转换为选项值,EVALUATE 是您的最佳选择!:)
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);
// 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;