Monday 20 October 2008

RunBase - classes and Best Practice

There are certain classes which serve as excellent templates. One such class the LedgerExchAdj-class. If only all runbase-classes were as this one. In my opinion its simplicity and readability is top-notch. I've edited the class-specific code so that only the run() template is present, which included that all important error handling, which one might forget



public void run()
{
#OCCRetryCount
;

try
{
ttsbegin;
// Insert code here
ttscommit;
}

catch (Exception::Deadlock)
{
retry;
}

catch (Exception::UpdateConflict)
{
if (appl.ttsLevel() == 0)
{
if (xSession::currentRetryCount() >= #RetryNum)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}

Friday 3 October 2008

Setting Cross-reference update in a Schedueld task

An updated Cross reference is an indispensable tool when developing for AX but the client-side dependency can be annoying. So after a little research I found the command line parameter/Windows build-in Scheduled task combo and it does the trick.

In the class SysStartupCmd's construct the command line parameter compileAll-startup command the the parm _+ instantiates a complete compile and cross reference update which means that if you set-up a Scheduled task in Window's standart scheduled task tool with the parameter -startupcmd=compileAll_+ you can update when it suits your development team best.

Tuesday 26 August 2008

MB6503 - AX 4.0 Installation and Configuration certification

So, I've done it - I got my AX 4.0 Installation and Configuration certification. Actually this test was harder than I expected it to be but there's my five cent worth of advice for those of you who are preparing to take this exam. RTFM ( here an abbreviation of read the fun manual). Nearly all the answers are to be found in the Installation and Configuration manual provided by MS. Hands-on experience will also greatly increase your chances of passing this test, in my opinion.

Wednesday 20 August 2008

OpenOffice and Dynamics ax

Here is an example of how to use OpenOffice together with Dynamics AX (code-wise of course)

static void Job2(Args _args)
{ COM OpenOffice;
COM DeskTop;
COM Document;
COMVariant arg;
Array arr = new Array(Types::String);

//Creating instance of OpenOffice.org
OpenOffice = new Com("com.sun.star.ServiceManager");
DeskTop = OpenOffice.CreateInstance("com.sun.star.frame.Desktop");

// create and initialize a COMVariant object
arg = COMVariant::createFromArray(arr);
//Creating the document
Document = DeskTop.LoadComponentFromURL("private:factory/scalc", "_blank", 0, arg);
}

Original post by Ivan Kasperuk

Tuesday 8 July 2008

My coding practice vs. your practice

your program (n): a maze of non-sequiturs littered with clever-clever tricks and irrelevant comments. Compare MY PROGRAM.

my program (n): a gem of algorithmic precision, offering the most sublime balance between compact, efficient coding on the one hand, and fully commented legibility for posterity on the other. Compare YOUR PROGRAM.

Monday 7 July 2008

How to close a form after a certain timespan

Sometimes it would be really nice if a form closes automatically after a certain timespan. I found it particulary useful in ShopFloorControl, where end-users might not have a mouse to point to close on a form.

On the forms run:

public void run()
{
str JmgJobId;
// Define variable for timeout
// Created with new int on JmgParameters
int TimeOut = JmgParameters::find().JmgRegistredOnJobPromptTime;

// Check if there is a parm
if(element.args().parm())
{
JmgJobId = element.args().parm();
jobIdTxt.text(JmgJobId);
}

super();

// Close form after TimeOut
this.setTimeOut(identifierstr(close),TimeOut);
}



Sunday 25 May 2008

DAX 2009 RTM ready on Partner Source

Here it comes - the RTM of 2009. You can download it from ParterSource (requires a ParterSource access as always). I've been experimenting with the TAP for some time now, and I must say that I like it more and more every time I open it. The project module is changed substatially compare with 4.0 which might prolong the learning curve.

Along side the actual RTM there is also an upgrade-document if you plan to upgrade already exsisting Axaptas to Dynamics AX 2009, and I'm glad to find out that there is an option of upgrading directly from 3.0 to 2009, which really eases application upgrades and transitions.

I can't wait to get going with the DAX 2009.

Happy hacking

Monday 19 May 2008

WinMerge - a nifty little compare-tool

When checking for consistency between labels I use a nifty little tool called WinMerge. It's OpenSouce and has a shell-integration which eases daily use. It can be downloaded from here

Monday 28 April 2008

Inside Microsoft Dynamics AX 4.0 free e-book

Harish Mohanbabu was kind enough - per proxy qua his blog - to bring to my attention that MS has release a free e-book edition of Inside Microsoft Dynamics AX 4.0 here as a pdf. I quite like the book as it serves both as an introduction to general X++ development and as a reference guide for more specific programming problems.

Friday 18 April 2008

Applying agile software development to Dynamics AX development part I

Ever since I wrote my thesis at university, I've pondered the fine art of software development methodologies. During my last year at the University of Southern Denmark I "shopped around" and followed a myriad of software related courses, e.g. Agile software development, User-centered software development, and other iterative and waterfall based software development processes. These development methodologies all have ther merits and flaws, which will be well known to any software developer and the process of merging business processes and software development processes is notoriously difficult, though it is of the utmost importance in order to achieve the best results, business- and softwarewise.

The courses I followed at university were mainly concered with the whole development process(es) from early conceptualization to post-installation maintenance, including GUI-development and Business Intelligence reports. Therefore when I started developing (or should I say customizing -a point to which I will return later) Dynamics AX for customers, my craze - User-Centered Design - slowly fell to the background. Is customizing an ERP-programme, such as Dynamics AX, merely a question of replicating exsisting business processes, with some optimization, and merging them into a new ERP-application or is the development of an ERP-solution an almost god given chance to take a critical bird's eye view of the whole organization and try to optimize business processes all the way r0und? The latter would seem the obvious answer but this again begs another question, viz.: can business processes be optimized isolated from the software development process, when the software has a central place in today's organizations? No. Of course it cannot.

All to rarely is there any substantial software development theory included in the business development plan for the implementation of a ERP-system. Traditional user-experience studies / examinations are left behind, because the UI is developed for us, as part of the standard application in the Dynamics-series, and it is 'just' (I know I'm a bit hard here - but I'm trying to get my point through) a question of rearranging data-presentation, based on the customer's prior ERP-system or an external system. All too often does the customer say something like 'that's not the way it was in the other system' when confronted with an newer version of, lets say Dynamics AX.

So the big question is: how do we - as software developers and business consultants - merge the two worlds and come-up with a process which will lead to sound business optimization and software development integrity?

Friday 11 April 2008

More new stuff from Dynamics AX 2009 - Developer Documentation improvements

During the week I had some more time for myself and my Dynamics AX 2009 CTP3. I've dived into the depths of the developer side of the CTP a bit more and discovered many new things and improvement compated to the previous versions. I looked at version control breifly in a previous post which I am looking forward to seeing in action when multiple developers are working on the same installation at the same time.

When browsing through the tables I found a new entity on the property of the table, DeveloperDocumentation which at first sight appears just to be a simple label. But the truth is much more interesting which became clear when I found a new node in the Add-in node of e.g. InventTable. DeveloperDocumentation is referenced to - it appears - the Dynamics AX SDK, which can be found online. Though it exsisted in 4.0 and 3.0 for that case, in 2009 it is wastly more elaborate. In Dynamics AX 2009 it is integrated in the MorphX IDE, as developers might recognize from other IDE's - Visual Studio etc. Yes - I know that AX developers might have gotten used to having the SDK open in a browser window next to Dynamics AX, but once again the consolidation of development envirionments, which was set forth in a MS road-map earlier, shines through, and I like it. The developer documentation was available in earlier versions of AX but the most commen result was "There is no information on the topic". The developer documentation in 2009 pretty much provides the information which is available from the online SDK but is updated and streamlined with e.g. Visual Studio's SDK, which - as you might know - also can be accessed from within the studio itself. The developer documentation node is also available for other elements in the AOT - classes, EDTs - just in case you were wondering.

Tuesday 8 April 2008

Import items into InventTable and associated tables

Yesterday I needed to import item data into a company for testing purposes, so I wrote a small job which reads an csv-file containing itemId and itemName and creates the posts in InventTable and its associated tables, InventTableModule and InventItemLocation

static void InventTableImport(Args _args)

{
//
//Author : Steffen Denize
//Purpose : Demonstration for importing InventTable into Dynamics AX
//
InventTable inventTable;
CommaIO inFile;
Filename filename;
Dialog dialog;
DialogField dialogField;
ItemId itemId;
int counter;
InventTableModule inventTableModuleBuf;
InventItemLocation inventItemLocationBuf;
ItemName itemName;
;

//
// Note - In this example, I have used 'Dialog' & DialogField classes
// as a tool for me to select the file that has to be imported.
//
dialog = new Dialog("Demo of import of items into a blank InvenTable");
dialogfield = dialog.addField(typeid(Filenameopen), "File Name");
dialog.run();

if (dialog.run())
{
filename = (dialogfield.value());
}

//
// Note - In this example, I have used CommaIO class. But you can also use
// AsciiIO class as well. Basically all these classes (AsciiIO, CommaIO,
// Comma7Io etc) derives from 'Io' base class. For more info, please
// refer to Io class.
//
inFile = new CommaIO (filename, 'R');

if (!inFile || infile.status() != IO_Status::Ok )
{
//strfmt - function for formatting text string
throw error (strfmt("@SYS19312",filename));
}
ttsbegin;

// Set the delimiters
infile.inFieldDelimiter(';');
infile.inRecordDelimiter('|');

//Checking status of last operation
while (infile.status() == IO_status::Ok)
{
// Setting container according to datatypes
[itemId, itemName] = infile.read();
if (itemId)
{
if(!InventTable::find(itemId).RecId)
{
inventTable.initValue();
inventTable.ItemId = itemId;
inventTable.ItemName = itemName;
// These values must be set on their respective tables.
// Here the value are hard-coded into the import as the import
// serves a demo purpose only
inventTable.ItemGroupId = 'TST';
inventTable.ModelGroupId = 'TST';
inventTable.DimGroupId = 'TST';
inventTable.Insert();

// Values must be setup in inventTableModule, which in Dynamics AX 4.0SP2 has three valid arrayelements
// purch, sales, invent (DEL_smmQuotation is not included in this job)
for(counter = 0; counter <= 2; counter++)
{
inventTableModuleBuf.ItemId = inventTable.ItemId;
inventTableModuleBuf.ModuleType = counter;
inventTableModuleBuf.insert();
}

InventItemLocationBuf.ItemId = inventTable.ItemId;
InventItemLocationBuf.inventDimId = InventDim::inventDimIdBlank();
InventItemLocationBuf.insert();
}
}
}
ttscommit;
}

Please notice that the posting is provided "as is" with no warranties and confers no rights

Friday 4 April 2008

How to setup automatic sync with Seagates FreeAgent Go

Coming from XP to Vista is not as difficult as I would expect, though some of the software which I found indispensable in XP is not quite mature enough for a 64-bit version of Vista. One such piece of software is my automatic synchronization of documents to an external harddrive. In XP my FreeAgentGo 160GB external harddrive contained an exact copy of my documents folder - just in case - so big was the surprise when I tried to install the FreeAgent Tool on my 64-bit only to discover that the software wasn't supported on 64-bit OS'es. Having cussed for a while I tried to run the application in Windows 2000 compatability mode, and lo and behold, the installation ran perfectly and post-reboot, the sync is up and running again. Hurrah.


Friday 28 March 2008

First impressions of Dynamics AX 2009 CTP

Well, I had my first experiences with the CTP of the upcoming version of Dynamics AX - the 2009 edition - and I must say that if you found the changes from 3.0 to 4.0 hard to adapt to, then this upgrade is going to blow your shoes off. The user-interface is brand new, and the consolidation of user experience across the whole range of Microsoft products is beginning to shows its value. Many hings users know and are accustomed to in other products are now present in Dynamics AX 2009, among other things the ribbon, known from Office 2007, and the navigation pane.

As a system engineer, I naturally looked for new things on the developer side of the upcoming version. On of the things I really missed in 4.0 was a build-in version control option. I know you had the option of installing a VSS-server to take care of Version Control for your installation, but the installation process was cumbersome, in my opinion; especially if you only required version control for a single installaion. In the CTP of Dynamics AX 2009 you have no less than four different option of Version Control at your finger-tips.
This will really ease the use of version control as the development team can chose exactly the type of version control which suit their needs. The MorphX VCS is a local, application integrated version control, which does not require any further software installation, which makes it perfect for smaller development teams, which might not have a use for the Team Foundation Server or a Visual SourceSafe. The MorphX allows the development team to check whole projects or single/multiple items from the AOT and has the option of adding descriptions.


Another nifty feature is the export to Excel-button, which pretty much exports the current records to an Excel-spreadsheet. This is an easier and faster way to extract simple data, which most likely will come in handy for a large number of users.


These are just some of the changes in the upcoming version of Dynamics AX 2009 and my first impressions are that the consolidation of user-interfaces across other MS products will ease the transition from previous version of Dynamics AX to upcoming 2009-ed.

Wednesday 26 March 2008

Dynamics AX 2009 CTP3 release

Here it is - the first widely distributed prerelease of the upcoming version of Microsoft Dynamics AX 2009.

It's available for download from PartnerSource (requires a PartnerSource login).

One of the many exciting new features is the Role centers and the new integration with Microsoft Project Server. I'm personally really looking forward to getting my hands on this CTP3 and experiencing many of the new features which this upcoming version has to offer.
You can find a comprehensive description of the features in the Dynamics AX 2009 on PartnerSource from the What's New in Dynamics AX 2009 (requires a PartnerSource login).

Hope you find the CTP3 as exciting as I do.