Code highlighting

Wednesday, March 26, 2008

Microsoft Dynamics AX 2009 CTP3 release is available on PartnerSource

Finally, the CTP3 release is available for download from PartnerSource.

It is, as usual, a VPC image that you can install on a standalone computer.
Be warned, that the size of the image is huge - about 7 Gb in 3 parts.

Here is a short description of the toolkit:

The Demonstration Toolkit for Microsoft Dynamics AX 2009 Pre-Release (CTP3) contains marketing materials, demonstration scripts, and a Virtual PC image containing a full installation of Pre-Release of Microsoft Dynamics AX 2009. You can obtain the Demonstration Toolkit on DVD from a Microsoft Dynamics Partner, or you can download the contents of the DVD using the links on this page.


Download link (Requires PartnerSource access)
It would be very interesting to hear any comments you might have about the CTP release, as well as about any major (and minor, as well) bugs you might find in this PRE-release. Feel free to e-mail me or leave a comment under this post.


P.S. (One day later)
An ISO image was also made available today. It is much lesser in size, and is an image of the installation CD + licence file for CTP3 release.
Download link (Requires PartnerSource access)

Friday, March 14, 2008

AxForum in English / AxForum auf Deutsch

There was a blog post recently about using Google Translate! to read posts on AxForum, one of the best communities there is on Microsoft Dynamics AX.

Here is the direct link to AxForum translated from Russian to English with Google Language Tools (Google might think you are a virus, so you in some cases will have to input a verification line to continue)

What I would like to point out and promote here, is the fact that AxForum actually has support for User Interface in English and German, and sub-forums in both languages:

AxForum in English
AxForum in German (auf Deutsch)

There aren't many posts there at the moment, but all AxForum members would be glad to help anyone who posts a question in one of these sub-forums (if they know that language, of course). So don't be shy and visit the sub-forums when you are in doubt or have a problem you cannot solve on your own.


You can find the original post about Google and AxForum here

Monday, March 10, 2008

Microsoft Dynamics AX 4.0 Service Pack 2 is available for download

Just a short announcement today:

The Demonstration Toolkit for Microsoft Dynamics™ AX 4.0 Service Pack 2 (SP2) contains marketing materials, demonstration scripts, and a Virtual PC image containing a full installation of Microsoft Dynamics AX 4.0 SP2.

Download link (Requires PartnerSource login access)

P.S. Just a warning for anyone unaware - the VPC image is very large, as it cotains an operating system, SQL server, AX install with demodata, etc., total size exceeding 9 GBs)

Saturday, March 08, 2008

Hotkeys and Find vs Filter in Dynamics AX 2009

In Microsoft Dynamics AX 2009 a number of changes regarding Filtering in grids were introduced. I would like to talk about one of them today.

As most of you know, in AX 4.0 the Ctrl+F hotkey was replaced with Ctrl+K, which was very confusing for customers that were using AX 3.0 at the time. (see one of my previous posts with a .dll go fix that)

Well, I am happy to tell you, that Ctrl+F is now back as a regular (not Global) Find option in AX 2009. But Ctrl+K is also available. So it was decided, that having to identical commands is not really smart. So now they actually perform different actions.

Ctrl+F is Find
Ctrl+K is Filter = Filter by Field from the context menu on the grid line.

Now, you might wonder what the difference is. I will explain it on an example:

You have a grid with items of different Item Type (BOM, Item, Service) and different Item Group (Parts, Bulbs, etc.)

Scenario 1: (Notice the dialog caption is Filter)
1. Press Ctrl+K on Item Type "BOM"
2. Press OK (the value BOM is already inserted in the search field).
3. Only BOM items are shown
4. Press Ctrl+K on Item Group "Parts"
5. Press OK (the value Parts is already inserted in the search field).
6. Now only BOM items with Item Group = Parts are shown.

Scenario 2: (Notice the dialog caption is Find)
1. Press Ctrl+F on Item Type "BOM"
2. Input "BOM" and press OK (you have to input the value you are searching for every time).
3. Only BOM items are shown
4. Press Ctrl+F on Item Group "Parts"
5. Input "Parts" and press OK.
6. Now only items with Item Group = Parts are shown, including both BOM and other Item types.
So, basically, all previous filtering on the grid was removed before applying the new search criteria.

As a side note, I would also like to mention, that some changes were made to hotkeys in the Editor: Now, Editor Scripts are opened using Alt+R hotkey, instead of Alt+M, as in previous AX versions. (Alt+M was reserved for the global menu toolbar, which is one of the new features in AX 2009 as well)

Find all reports with datasources innerjoined 1:n

I haven't really written much X++ code in the past 5 months, so a work-related task on X++ was like a holiday :)

I needed to find all reports, in which there is a child datasource (on some level) that is inner joined with the parent datasource as 1 to many.

Here is one of the possible solutions of the problem.
I would also want to talk a little bit about different methods used in this scenario, in case some of you are still unfamiliar with those:

static void FindReports(Args _args)
{
#AOT
Report report;
TreeNode treeNode = TreeNode::findNode(#ReportsPath);
TreeNodeIterator iterator = treeNode.AOTiterator();
QueryBuildDataSource qbds;

boolean find1nInnerJoin(QueryBuildDataSource _qbdsParent)
{
int i;
QueryBuildDataSource qbdsChild;
boolean ret;
;
for (i = 1; i <= _qbdsParent.childDataSourceCount(); i++)
{
qbdsChild = _qbdsParent.childDataSourceNo(i);
if (qbdsChild)
{
if (qbdsChild.joinMode() == JoinMode::InnerJoin && qbdsChild.fetchMode() == QueryFetchMode::One2Many)
return true;

if (qbdsChild.childDataSourceCount() > 0 && find1nInnerJoin(qbdsChild))
return true;
}
}
return ret;
}
;

treeNode = iterator.next();
while (treeNode)
{
if (treeNode.sysNodeType() == 202) //Report
{
report = treeNode;
if (report && report.query().dataSourceCount() > 1)
{
qbds = report.query().dataSourceNo(1);
if (find1nInnerJoin(qbds))
info(report.name());
}
}
treeNode = iterator.next();
}
}


Here are some keypoints:

1. Notice the use of TreeNodeIterator class. This is an example of an Iterator applied to the AOT. Very convenient and easy to use. You can read more about this class and its methods on MSDN

2. Notice the use of BaseEnums QueryFetchMode and JoinMode - I have seen many developers specifying integer values instead. I would suggest using these enumerations instead - the code will be much easier to read later on.
I don't know the enum for return value of method treeNode.sysNodeType() though. So if someone does, write a comment - it would be nice to know.

3. Notice the use of an implicit conversion from a base type object (TreeNode class) to a derived type object (Report). This is allowed, because, as you know, X++ type system is a "weak" type system. But beware, because this might lead to run-time errors. For example, if you call a method on the Report class, that is not inherited from the TreeNode class, you must be absolutely sure that the object is actually of type Report. Otherwise, you will get a run-time error.
This is why before the conversion, I verify that only Report objects get through to the following code.

4. The last, but not least: Notice the methods exposed by the QueryBuildDataSource class - basically, it allows to receive a lot of information about a specified query. Again, for more information, refer to MSDN