Tuesday 8 January 2013

Microsoft Dynamics AX 2012 R2 - any2Real Function


Converts an anytype value to a real value.


Function

  • real any2Real (anytype object)

Parameters

  • Parameter: object
  • Description: The value to convert.
The object parameter can be of most data types, but useful output is obtained for input elements of the date, int, enum, and str types.

Return Value

  • A real value.

Example

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

   s = "5.12";
   myReal = any2Real(s);
   Global::info(strfmt("%1 is the output from the input of 5.12 as a str object", myReal));

   i = 64;
   myReal = any2Real(i);
   Global::info(strfmt("%1 is the output from the input of 64 as an int object", myReal));

   a = NoYes::Yes;
   myReal = any2Real(a);
   Global::info(strfmt("%1 is the output from the input of NoYes::Yes as an enum object", myReal));
}
/****Infolog display.
Message (02:43:57 pm)
5.12 is the output from the input of 5.12 as a str object
64.00 is the output from the input of 64 as an int object
1.00 is the output from the input of NoYes::Yes as an enum object
****/

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

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

No comments:

Post a Comment