Microsoft Dynamics Ax developer's blog

Friday, December 21, 2007

Blogroll

Just added a blogroll to the right bottom of my blog template. This blogroll is generated by Google Reader and represents all blogs in english I have subscribed to.

Friday, November 16, 2007

Comparing the Microsoft and Google tool chains

An interesting post about tools (software and hardware) which are used by Microsoft and Google developers.

By the way, I have two monitors too, and it is very useful for development in Ax, especially, for debugging display methods: when I had application and a debugger on the same screen, it was an ether not enough screen space (when debugger and application were placed side-by-side), or a deadloop (when I close the debugger, the underlying window starts to repaint, so display method was called again and debugger appears again).

Thursday, November 01, 2007

Gantt

Gannt charts in Ax are displayed Netronic VARCHART XGantt ActiveX control. If you follow the link you can download CHM and PDF documentation (about 900 pages) on it...

Friday, October 26, 2007

FarManager 1.80 will be Open Source



Far Manager1.80 will be Open Source.

FarManager is my favorite Norton Commander-like file manager.

The real power of this piece of software is in plugins. For example, a friend of mine had implemented a nice IDE for BAAN ERP based on FAR. And I also have some experience in this field.

Maybe, it looks weird for people, who do not remember DOS and NC, but is really powerful

Thursday, October 25, 2007

MS CRM in dotnetrocks

It is announced that the next tuesday a new dotnetrocks podcast show on MS CRM will be available:

10/30/2007
David Yack Talks Microsoft CRM!


AFAIR it is the first DotNetRocks show related to Dynamics

Tuesday, October 23, 2007

new version of the DEV_CreateStandardsMethods extendion



The extension now can add suffix to created methods and is fully translated to english. For example parameters from the screenshot will lead to creation of findByGUID and existByGUID methods. See axaptapedia article for download and details.

Monday, October 15, 2007

Wednesday, October 10, 2007

Print editor hotkeys

Just uploaded a printable version of editor hotkeys. I like lookup facilities of the code editor (F2 for tables and fields), but somtimes forget key combinations. Now I have printed it and sticked it to have it in front of my eyes.

Maybe it can be useful for you also...

Wednesday, October 03, 2007

Tabax is one year old

About one year ago the first version of tabax was released to public

Great Thanx to all people who took part in Tabax development: AndyD, Ivan, OIP and others.

And for i18n: Manel, Helmut, Romain Gasnier

BTW, Google Alerts gave me some Brazilian blog in Portugues and the only thing, that I can read there was Tabax :)

Below there are two screenshots:

A sidax predecessor, which was developed sombody from axforum




First internal version of sidax (which is two year old now).






Tuesday, August 07, 2007

Tabax 0.3.2

download
Changes:
  • AxPath: use of primary key of the record instead of recID
  • French localization (thanx to Romain Gasnier)
  • If tabax can not find it's resources on disk it tries to download them from Ax resources (useful for Ax 4 installations)

Tuesday, July 31, 2007

Unwanted fields fetching when selecting by unique index

UPD: Sorry, EmplTable is not good example - because of cache enabled. But this behavoiur is tested with a specially created table with CacheLookup==None.

Last friday i was optimizing a form with a lof of display fields with an implementation like the following:

display EmplName emplName()
{
return EmplTable::find(this.EmplID).Name;
}

The one of sources to increase performance of such code is to select only fields which will be used lately. So I have replaced this code with the following:

display EmplName emplName()
{
return this.EmplID ?
(select Name from EmplTable
where EmplTable.emplID==this.EmplID).Name
:
"";
}

but when I enabled SQL tracing, I found, that this code producess select with ALL fields of EmplTable.
It was strange... With a great help of my co worker, i've found the following:
  • when there is only fields of any unique index in the where condition, all fields are fetched
  • when there is an extra field in the condition, only required fields is selected (and the extra fields in where)
  • So I converted previously mentioned methods to the following:


display EmplName emplName()
{
return this.EmplID ?
(select Name from EmplTable
where EmplTable.emplID==this.EmplID
&&
EmplTable.recID
).Name
:
"";
}

Thursday, July 12, 2007

TabaxLite

TabaxLite is a stripped down version of Tabax for end users.
It is focused solely on the window management and does not require any external component



Wednesday, July 04, 2007

Hosting the Windows Workflow Foundation designer


Windows Workflow Foundation (WF) is the new MS technology. It comes with .NET framework 3.0.

It is interesting that workflow designer can be hosted by any app (here is an example).

And maybe someone can make an ActiveX which can be hosted by Axapta form (here is an example of ActiveX control implemented in C#)

Thursday, June 21, 2007

Sending attachments using the "mailto:" protocol

It works with Outlook at least. I think this example job is enough

static void Test_MailTo(Args _args)
{
str recepient='mbelugin@gmail.com';
str subject = 'Test';
str attachment = @'c:\AUTOEXEC.BAT';
str url = strFmt(
'mailto:%1?Subject=%2&attachments=""%3""',

recepient,
subject,
attachment
);
;
WinApi::shellExecute(url);
}

Tuesday, May 15, 2007

setPrefix

The first line which I always write at the start of the 'run' method in a RunBase descenant is:


setPrefix(this.caption());


Settings prefixes is very useful for detect causes of errors later.

There are also very useful macros: PrefixField, PreFixFieldValue

For example, this code will set prefix to the: "

Monday, May 14, 2007

Tabax v 0.3

download (87k)

After the long period of beta stage, the new release of Tabax is out.
tabax screenshot

This release introduces several new features which will be very useful for developers and end-users

First of all, it works under version 4 of Dynamics Ax.

Second, it introduces the Tabax Plugin API which allows developers to increase functionality of Tabax sufficiently.

There is a plugin for Tabax (in the tabax archive) to integrate AxPath with your system: so, if you install this plugin, you can click on AxPath links in browsers and email clients and go to specific location in code or specific record in the database (thank to AndyD for this functionality).

Ivan Kashperuk has developed a great plugin named RecentWindows which I use heavily. If you close some window, it allows to reopen it quickly.

Also, Ivan added a very useful feature to Tabax: if You press the 'Edit current field' toolbar button, while holding Ctrl and Shift down, Tabax will open a table field or data method related to the currently selected form field.

I have added similar fuctionality to the 'cross referebces' buton - now You can press it while working with form, and you will see cross refereces for the fireld related to the active control.

There are also some minor bugfixes and enhancements in this release

Thursday, May 10, 2007

AxPath is supported by axaptapedia

So you can create links to AOT items in Axaptapedia using regular link syntax and if you have Tabax 0.3 rc 1 installed, you can navigate them.

Thanks to Andrew Jones!

Tuesday, May 08, 2007

DLR & X++

About a week ago Microsoft has announced the new technology named DLR. As far as I know, this is a layer for dynamic languages support on top of .NET framework. I watched the very interesting video where integration of Python, Ruby and JScript is shown.

But what can it give to Dynamics Ax?

I think X++ have some features of dynamic languages.

For example, method identification is being done via method names, not some kinds of method ids (i.e. virtual methiod table indexes like C++). If you write code like

MyClass x;
;
x.myMethod();


compiler checks that class MyClass have method myMethod, runtime checks, that object x has method myMethod, but run time does not check whether x is instance of MyClass.

So you can write something like

MyOtherClass y=...;
Object o=y;
MyClass x=o;
;
x.myMethod();


the code will be executed successfully if MyOtherClass have method myMethod, even if MyOtherClass and MyClass have no common superclass.

Such tricks are used with forms (for example ; Tabax plugin SDK is using it also to provide compiler checks for tabax service methods usage).

So if Microsoft is planning to move Dynamics Ax to .NET platform, they should provide support for such behaviour for the backward comapatibility.

I think the work being done on DLR can be used in such case. Jim Hugunin, architect of DLR and and the author of IronPython says (see video mentioned above), that this implementation of the Python language outperform original C implementation (CPython) and runs 2 times faster on standard benchmarks. He also pays extremely high attention on backwards compatibility (for example, you can not use .NET object methods in IronPython code until you place "import clr" statement in your code).

I think when this job will be done and authors of DLR will find and mitigate dynamic languages problems in DLR and SilverLight, the result of the job can be used in the future dynamics products.

PS. I played some time with IronPython and found though it have pretty good perormance in requires a lot of time to initialize an engine and load a script.

Tabax 0.3 rc 1:

download (80K)

changes:

  • fixes bugs in AxPath

  • AxPath browser integration plugins is in archive in the extras folder

  • Plugin SDK documented

Wednesday, April 25, 2007

AxPath integration with browser email etc

With great help of AndyD, Tabax now have an integration with browser and other tools. For example you can send a link to the specific purchase order via outlook, and when the link will be clicked, user will see purchase order you linked to.

You can also link to the specific parts of code. For example here tabax checks your access to development environment when you are navigating AOT link.

How to make it work:

  • download the latest beta of Tabax
  • Install Tabax and Plugin SDL
  • download and install AxPath plugin. Run register.bat

Monday, April 23, 2007

SYS_ExpressionQueryBuilder

SYS_ExpressionQueryBuilder is an ExpressionBuilder for queries. Read more @ axaptapedia

InventTrans inventTrans;
QueryRun qr = SYS_ExpressionQueryBuilder::construct()
.dataSource(tableNum(InventTrans))
.count(fieldNum(InventTrans, RecID))
.groupBy(fieldNum(InventTrans, ItemID))
.between(fieldNum(InventTrans, DatePhysical), 01012006, 31122006)
.matches(fieldNum(InventTrans, Qty), '<0')

.exists(tableNum(InventDim))
.link(fieldNum(InventTrans, InventDimID),
fieldNum(InventDim, InventDimID))
.matches(fieldNum(InventDim, InventLocationID), condition)
.run();
;
while(qr.next())
{
inventTrans = qr.get(tableNum(InventTrans));
info(strFmt('%1: %2', inventTrans.ItemId, InventTrans.RecId));
}

Tuesday, April 03, 2007

Infolog stack trace



This extension allows to see stacktrace of infolog items and navigate through call stack. read more @axaptapedia

Monday, March 26, 2007

Tabax 0.3 beta 3

Starting a beta stage of the new Tabax version (download)

What's new since 0.2.x:

  • Works with Ax 4 (icons are in tabax.ax4 they should be copied to "C:\Program Files\Microsoft Dynamics AX\40\Client\Share\Include\tabax")
  • User interface can be localized (it is translated already to Russian and Spanish (the last by Manel Querol (Mkz) from http://www.TrucosAx.com))
  • windows management (enable "fit maчimized" in setup and your window maximization will be emulated with fitting)
  • tab width setup (maximal width, minial width and "Tabs have same size")
  • Plugin SDK (it's only first small step)
  • Ivan Kashperuk added the "Open table field" functionality to the "Edit current field" button
  • Autosize: tabax don't let to change it's size

Friday, March 09, 2007

Tabax 0.2.15 -- fit mazimized windows

homepage

download (30K)

There are two changes:
1. "Fit maximized windows" setting added -- thanks AdnyD
2. Bug in table browser removed -- thanks Ivan Kashperuk

One of tabax users asked for the "Fit maximized windows feature". In you enable it tabax will fit window to the client area of Ax main window when detect maximization of some inner window.

I think, everybody do not like the following Ax behaviour: when you maximize window (for example code editor) and then open child window, the first winow change it's size. The new Tabax feature prevents it behaviour - it just normalize all maximized windows and fit them to the maximal size they can get without some parts being hidden. So when new window is displayed, prevoius window do not change it's size.

What do you think about this feature?

Tuesday, February 20, 2007

Podcasts



I am now in pause between the two jobs. So almost every day I am walking through the nearby forest park with my child. She is sleeping and I have about three hours to do something interesting or useful. Snowflakes falling down do not allow me to read on paper or my pocket pc, but I can listen podcasts or webcasts.

The additional reason to do such things is to learn spoken english. For example when MS contacted me via phone on the SQL injection hole i've found (BTW i have tried to reproduce it on Ax4 and it is still here) I was not able to understand almost anything from what they have spoken.

So I need to train...

The first candidate to listen is the list of webcasts on channel 9 tagged with "Dynamics" because it is an interesting topic to me.

It is very useful, but have some disadwantages:

  • the files are very big - I need soundtrack only
  • my mp3 player can not play wmv smoothly (and it plays them only after renaming them to .wma) - I am forced to use a Pocket PC
  • I feel, I can get a slight Danish accent (it is nice, but I think not when mixed with Russian ;) )


So I am switched to other podcast named .NET rocks - an internet radio about Microsort .NET and related technologies. It is interesting for me, sounds quite professional and, I think, made with a clean American English.

Can you recommend me interesing podcasts in English?

Do you know something for extracting soundtrack from a wmv file?

PS. The latest ".NET rocks" show is with a Steve McConnell, the author of the "Code complete" book, recomended recently by MFP

Saturday, February 17, 2007

Sidax 0.4 b 2

See page at axaptapedia for details. It is strongly recommended to upgrade beta0 to beta 1 or beta 2.

Tuesday, February 06, 2007

Python

Every programmer, ecpecialy one, which deals with some ugly language like X++ or BAAN 4GL should know some scripting language. Its a kind of practical and easy tool which allows you to write small programs quickly, in cost of performance.

My favorite is Python. It is nice, mature enough and widely supported (even my Pocket PC has an interpretter).

For example one task which I did with python a couple days ago is a preparation of data of the legacy system to load in Dynamics Ax. The source file consists of text lines, where data fields are separated with the piplene character ('|'). Some of data fields values contain pipeline character too. The first field of the line identifies type of the data (invenotory group or inventory item). The file was encoded using DOS (cp866) encoding. So there was 3 actions po perform:

  • recode data to Windows encoding (cp1251)
  • separate item data from inventory group data
  • check for lines which pipeline in data


It was done by the following scipts:

1. Splitting files by data type and converting from DOS to Windows

src=open('input.txt', 'r')
dst = {'asl': open('inventory.txt', 'w'), 'ctl': open('group.txt', 'w')}
lineNo = 1
for line in src:
type = line.split('|')[0]
if type in dst:
try:
dst[type].write(line.decode('cp866').encode('cp1251'))
except:
print line
print lineNo
lineNo += 1


2. Checking for correctnes:

import sys
lineCount = 8
fileName = sys.argv[1] if len(sys.argv)>1 else 'inventory.txt'
for lineNo, line in enumerate(open(fileName, 'r')):
if line.count('|')!=lineCount:
print lineNo
print line.decode('cp1251').encode('cp866')


As you can see it is readable and easy.

If you get interested, look at the following links:

Thursday, February 01, 2007

Tabax 0.2.14: View query of the active datasource

A new version of tabax:

download (27K)

Now you can view the source of the query in the active datasource by simply holding Ctrl+Shift while pressing the 'Table browser' button (code by Ivan Kashperuk).

Also you can list all datasources on the active form and then browse the data by holding Shift while pressing the 'Table browser' button.

Friday, January 26, 2007

Dynamic analog of abstract macro

Palle Algemark have published an article witch solution of the same task which have been solved by abstract macro in my latest post. He uses table map and reflection code to achieve flexibility.

It is good, especially when you have ready to use map for all concrete tables. It is more difficult to create such map id you haven't.

For example you can not just declare fact, that you have same name for a field in each table; uou should: either repeatedly add declaration of all field mappings, or generate it by reflection code, or generate it in xpo.

The following dynamic code uses only list of tables and the fact, that ItemID has the same name:

static void Test_DictTab(Args _args)
{
container tables = [
tableNum(InventTable),
tableNum(InventJournalTable),
tableNum(InventJournalTrans)
];
int i;

void processTable(TableID _tableID)
{
SysDictTable table = SysDictTable::newTableId(_tableID);
Common record = table.makeRecord();
FieldID itemField = table.fieldName2Id(fieldStr(InventTable, ItemID));
;
while select count(recID) from record
where record.(itemField) == '001'
{
info(strFmt("%1 = %2", table.label(), record.RecId));
}
}
;
for(i=1; i<=conLen(tables); i++)
processTable(conPeek(tables, i));
}

Thursday, January 25, 2007

Abstract macro

Recently published article about trick, whch I have often used in BAAN and sometimes in Dynamics Ax programming.

read the article at Axaptapedia

Two days ago I have added a new inventory dimension and was impressed how many work can be eliminated using this trick...

But don't overuse macros in can lead to less readability of your code.

One time I have used macros to build something like internal DSL to describe mapping of Ax tables to interface tables on SQL server and now one my ex-collegue claim it is unreadable.

Tuesday, January 16, 2007

Tabax 0.2.13


what's new
Summary: open application object for the currently selected item in AOT, some managebility and extensibility.
download

Monday, January 15, 2007

WordSL - Microsoft Word as a visual XSLT editor

Just uploaded a varsion of the WordSL - tool which lets generate Word 2003 xml files via XSLT - you don't even need to have a word on a server to provide a file generation.

details...

Thursday, January 04, 2007

customization: do it smarter

If you haven't watched the video Dynamics AX 4.0 - Smart customizations - watch it! (especally if you are novice Dynamics Ax developer).

I can just add few thoughts:

First of all - this sceencast recommends to subclass existing class, but i thing there asre some cases when it is better to tweak existing class. The most often case - when existing class has bad structure (for example LedgerJournalCheckPost in 3.0 - i don't know about 4.0 so much). If you have one large method which does all you can not just overide it to add some functionality - you often have to copy all it's body to the child and tweak it. I you do so you will have more problems when upgrading to the next version: you have not only to upgrade method of existing parent, but to modify all copied parts of the child and there is no obvious clues to find what parts to modify.

Second, what can be done to make upgrades less painful:

  • Interfaces - there havte to be more documented interfaces - so Ax devs will know what they can change and what cannot to make Ax backward compatible.
  • Unit tests as part of Ax package - all unit tests developed by Ax team have to be shipped with Ax to enable partner or customer developers ensure they haven't breaked anything
  • Events - SAP R/3, as i know, have concept of events - you have not to modify existing code to be informed about some thing ocuured in system - you just subscribe, say, to journal posting and can make extra transaction if you want. So your customisation code isn't mixed with the existing code.
  • Better code structure - i think there is no excure for very big methods for example. Better code structure can be easy reused by customer programmers and can be seft documented and testable.