Code highlighting

Saturday, December 14, 2013

Tool: Update: User preferred startup menu for AX 2012


I have over the last year received a couple mails and comments from people, asking to publish an update for the below tool for AX 2012

http://kashperuk.blogspot.dk/2010/04/tool-user-preferred-startup-menu-for.html

There aren't really any serious changes to it as such, just some minor things.
Again, note, that there are a few changes to some of the existing "high profile" AOT elements, so please read through the description of changes in the above post.

Download updated xpo

Monday, March 11, 2013

Microsoft Dynamics Salary Survey 2013

The time of the annual Microsoft Dynamics Salary survey is again upon us.

Here's the official invite. Please participate, so we can make the data accurate statistically. They also have prizes for people participating.. :)
Link to start the Microsoft Dynamics Salary survey
Take the Microsoft Dynamics Salary Survey 2013 for a Chance to Win a Microsoft Surface Pro (128 GB), the Nokia Lumia 920 or Xbox 360 Kinect Bundle
Nigel Frank International would like to invite you to complete our annual Microsoft Dynamics Salary Survey. 
Take the survey and you will automatically be entered into our prize draw to win a Microsoft Surface Pro (128 GB), the Nokia Lumia 920 or Xbox 360 Kinect Bundle.
You will also receive a FREE copy of the Salary Survey report once it has been compiled.
The industry acclaimed annual “Microsoft Dynamics Salary Survey” is the world’s most comprehensive insight into global salary trends for Dynamics professionals. Use the survey to benchmark your team's, company's or your own salary.

Wednesday, August 29, 2012

Inside Microsoft Dynamics AX 2012 is available for Pre-Order


With the release of AX 2012 the market was in need of an updated book on the development aspects in X++/.NET for the purposes of extending the AX application functionality.

As some of you might know, I translated 2 of the MS Press books on AX development for the previous versions to Russian.

This time around, I was lucky enough to participate in the creation of the English version as well.


Inside Dynamics AX 2012 book cover
The book has been significantly updated to account for the numerous changes in the latest AX release, so I am sure many of you will enjoy the read.

The book is not out yet, but you can pre-order it at Amazon by using the link below

Pre-order "Inside Microsoft Dynamics AX 2012" now


Enjoy!

Thursday, February 23, 2012

Tutorial: Determine if a string is a valid UtcDateTime

In my post about UtcDateTime in Dynamics AX, I recently received a question about determining if a specific string is a valid UtcDateTime in X++.I've spent some time looking into it and could not find an available method that could be used for that.
Also, it was not really clear, which format should be called valid.

Anyhow, I have so far discovered 2 ways to do it in AX: the simple way, and MY way :) They produce slightly different results however. Let me know if you find other ways.

The simple way is to use the intrinsic function str2datetime.
As you can see on MSDN, it supports a couple of input formats, and if you provide a non-date value, will just ignore it silently and return an empty value.

However, when working with DateTimeUtil methods, the expected format is yyyy-mm-ddThh:mm:ss
And, as you can see from the below test job, specifically this format is not supported by str2datetime.
So I wrote my own method based on DateTimeUtil::parse(), that returns true/false based on the string value matching the above format. This is however the only supported format for DateTimeUtil, so the other 3 examples that work with str2datetime do not work here.

Anyhow, you can download the code (I've put the method into Global) and the test job from my SkyDrive.

Test job:
public static void isValidUTCDateTimeTest(utcDateTime _utcDateTime)
{
    boolean utc1 = str2datetime("2012/02/25 23:04:59", 321) != utcDateTimeNull();
    boolean utc2 = str2datetime("Feb-2012-25 11:04:59 pm", 231) != utcDateTimeNull();
    boolean utc3 = str2datetime("25 02 2012 11:04:59 pm", 123) != utcDateTimeNull();
    boolean utc4 = str2datetime("2012-02-25T23:04:59", 321) != utcDateTimeNull();
    boolean utc5 = str2datetime("XXXX", 123) != utcDateTimeNull();

    void showResult(str format, boolean isValid)
    {
        info(strFmt("%1 - %2", format, isValid));
    }

    setPrefix("Date time validation");
    setPrefix("str2datetime has multiple valid formats");
    showResult("2012/02/25 23:04:59",       utc1);
    showResult("Feb-2012-25 11:04:59 pm",   utc2);
    showResult("25 02 2012 11:04:59 pm",    utc3);
    showResult("2012-02-25T23:04:59",       utc4);
    showResult("XXXX",                      utc5);

    setPrefix("Correct UtcDateTime format for DateTimeUtil: yyyy-mm-ddThh:mm:ss");
    showResult("2012/02/25 23:04:59",      isValidUTCDateTime("2012/02/25 23:04:59"));
    showResult("Feb-2012-25 11:04:59 pm",  isValidUTCDateTime("Feb-2012-25 11:04:59 pm"));
    showResult("25 02 2012 11:04:59 pm",   isValidUTCDateTime("25 02 2012 11:04:59 pm"));
    showResult("2012-02-25T23:04:59",      isValidUTCDateTime("2012-02-25T23:04:59"));
    showResult("XXXX",                     isValidUTCDateTime("XXXX"));
}

Tip: Illegal 'closing bracket' character when defining a macro

Just a very quick tip today, related to macros:


As you all know, there are multiple ways to define and use macros in X++.
For those that need a refresher, please look up the corresponding section on MSDN
(Direct link: http://msdn.microsoft.com/en-us/library/cc197107.aspx)

Below is a simple X++ job, that demonstrates an existing shortcoming in the #define command, and a possible workaround for this problem.

Nothing complicated, basically, just use #localmacro, if you can't compile your code.

static void ClosingBracketInMacroDefinition(Args _args)
{
    //#define.Question("Why are brackets ')' not working ?")
    //#define.Question(@"Why are brackets ')' not working ?")
    //#define.Question("Why are brackets '\)' not working ?")
    #define.LegalCharacters(' !"#$%&\'(*+,-./:;<=>?@[\\]^_`{|}~\n\r\t')
    #localmacro.Question
        "Why are brackets ')' not working ?"
    #endmacro

    Box::info(#Question);
    Box::info(#LegalCharacters);
}

Thanks for finding the issue to Bogdana, one of our new developers.