Wednesday, April 13, 2011

What is the release data of Dynamics Ax 2012?

With Convergence 2011 taking place in Atlanta (US) right now, we see a peak in all the buzz on the web about MS Dynamics Ax 2012, the next major release of Ax.  Microsoft is releasing bits and pieces of information regarding new functionality, technical enhancements and so on.  And they have communicated on the release date as well, giving a new estimate.  As it was previously stated that general availability would be "Q3 2011", everyone expected this to be "September 2011".  But positive surprise:

   MS Dynamics Ax 2012 will be available in August 2011.

(Features and date come with a MS disclaimer, so all tentative right now.)

Tuesday, April 5, 2011

How to format your number the CLR style

Converting (real) numbers to a string representation is a common requirement. There are different roads that lead to Rome, I'll show you some alternatives, which all have one thing in common: They all use Format.

You can use num2str to convert your real numbers to a string, or you can use Format.
Example, controlling the number of decimals showed:  (decimal point acts as decimal separator)

static void FormatExamples(Args _args)
{
    real        mynumber=123.4;
    String30    mynumberstr = System.String::Format("{0,0:#.00}", mynumber);
    ;
    info(strfmt("Your number is %1", mynumberstr));
}

You can use the Format command to add leading zeros also.
Example:

static void FormatExamples(Args _args)
{
    real        mynumber=123;
    String30    mynumberstr = System.String::Format("{0,0:00000}", mynumber);
    ;
    info(strfmt("Your number is %1", mynumberstr));
}

Notice that you can also use rounding like this as well.  Besides this basic function, we can actually do some conversions.
You can use Format to convert to hexadecimal for example.
Example:

static void FormatExamples(Args _args)
{
    int        mynumber=255;
    String30   mynumberstr = System.String::Format("{0,0:X}", mynumber);
    ;
    info(strfmt("Your number in Hex: %1", mynumberstr));
}

Monday, April 4, 2011

A hidden feature of the output window

If you are an Ax developer then you've probably used the Print command in Dynamics Ax, either to do some debugging or during testing of code.  The print command allows you to print some results or some values to screen.  Optionally enter a pause statement at the end, in order to be able to read the actual output.

Example:

static void WindowDemo(Args _args)
{
    print('Hello world');
    pause;
}

Sort of a hidden feature in Ax, is that you can actually control the output window, both size and position.  You can use the Window command for that.

Example:

static void WindowDemo(Args _args)
{
    window 120,60 at 5,5;
    print('Hello world');
    pause;
}
With the Window command in following format

   window deltax, deltay at x,y

x   Top left position of the window, x-co├Ârdinate (Horizontal)
y   Top left position of the window, y-co├Ârdinate (Vertical)
deltax   Width of the window, in characters
deltay   Height of the window, in lines of text