4
It would be also nice to have a function that can convert to the enum value. If the value is comming from with a http response message as Json, it would be nice if this can be converted to the enum.
Example:
SomeEnum := "Some Enum Type".FromInteger(SomeOption)
or
SomeEnum := "Some Enum Type".FromText(SomeOption)
or
SomeEnum := "Some Enum Type".FromText(SomeOption, IgnoreCaptials)

If this can't be cast, then the code gives an error.

Now we must do it our self for each enum value that is used in http communication and also create extensibility functions for it, if the enum can be extended.
Category: Development
STATUS DETAILS
Needs Votes

Comments

F

Hi,

I'm not sure, but I think this can help: This function will convert (even translated)Text and numbers into a option or enum value and will give you the right OptionNo.

var   

ValidationManagement: Codeunit "Config. Validate Management";

begin

  Result := ValidationManagement.GetOptionNo(NewValueText, FldRef);

end;

Category: Development