Tuesday 8 January 2013

Microsoft Dynamics AX 2012 R2 - any2Enum Function


Converts an anytype value to an enum value.


Function

  • enum any2Enum (anytype object)

Parameters

  • Parameter: object
  • Description: The value to convert.
The object parameter can be of most data types, but useful data is only obtained by using parameters of a str or int type.


Return Value

  • An enum value.

Example

  • X++
static void any2EnumExample(Args _args)
{
    NoYes a;
    int i;
    str s;
    ;

    i = 0; // An int object that will be converted
    a = any2Enum(i);
    Global::info(strfmt("%1 is the output, from input of the %2 int object.", a, i));

    s = "1"; // A str object that will be converted
    a = any2Enum(myAny);
    Global::info(strfmt("%1 is the output, from input of the %2 str object.", a, s));

}
/**** Infolog display.
Message (01:05:30 pm)
No is the output, from input of the 0 int object.
Yes is the output, from input of the 1 str object.
****/

My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics AX 2012 R2 - any2Enum Function' was informative. Please feel free to leave your comments.

No comments:

Post a Comment