Microsoft Dynamics Ax developer's blog

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.

Monday, December 04, 2006

Go component

Just uploaded a new extension go component - this is like "go" tab from Sidax but standalone and integrated with editor via script.


I am using autohotkey macros to setup hotkeys for various actions and define Ctrl+Enter to go to selected component in the editor:

#IfWinActive, ahk_class AxaptaClientClassName
~^Enter::
SendInput,{APPSKEY}sg
Exit


So you can, for example, edit the class declaration, click on the class name of the class the current class entends and press Ctrl+Enter - you see the parent of the currently editing class.

Monday, November 27, 2006

Tabax 0.2.11

The main new feature is the new button "Edit current field". Open, say, ledger accounts form from main menu, select "Tax group" field and click this button.

You will see AOT for StringEdit:Tax_TaxGroup.

I think this button fill be helpful for developers and consultants to explore axapta functionality.

more...

Wednesday, November 22, 2006

Bunch of Tabax extensions

There are some Tabax extensions occured last week.


  • AxCreateNewProject from Ivan Kashperuk to create an empty project with two clicks

  • Toggle SQL trace for switch SQL trace On/Off instantly with tabax toolbar button (it can be used an example of reflecting state of something via button image )

  • Just a button to run the find dialog for AOT node quickly

Sunday, November 19, 2006

AxPath is coming: Sidax 0.4 beta 0 + Tabax 0.2.10

download tabax | download sidax

There is the first AxPath implementation. AxPath let you store a link for some record in database or an AOT item in the form of URI and then send it to a collegue or open it. So, for example you can copy link to the some purchase order, send it to colleague and it will be opened by colleague (so purchase orders form is opened and positioned at specific order).

Now Tabax, and Sidax support this technique. I am planning integration of AxPath scheme in the system letting AxPath links to be embedded in the webpages, mails, etc.

so, in Sidax:

  • you can copy AxPath of the menu item in main menu with right click
  • you can navigate AxPath via "go component"

in Tabax:
  • AxPath:
    • when pressing the "Copy" button it copies axpath of the current record to the clipboard
    • when pressing the «Ctrl+Shift+Copy» it copies AOT items, currently selected
    • if you insert axpath to the input box it navigates the path given

  • now tabs are switched correctly under AX3KR3
  • X++ calculator in the input box:
    • enter ?<X++ expression> and press Enter to evaluate an expression
    • enter ?<X++ statement> and press Enter to run a statement



I am going to implement "favorits" in the sidax based on AxPath

Wednesday, November 15, 2006

aggreg8.net - trying to aggregate all Dynamics Ax development blogs

Microsoft launched the new site for IT pros - aggreg8. I have'nt realized what it is exactly, but created the workgroup for Dynamics Ax and aggreated some development blogs there: view online

Monday, November 13, 2006

Sidax 0.3.7b14


download



changes:


  • Autohide option at about tab - sidax will autocollapse when you move mouse out of it's window (thank to Blokva from AxForum)

  • Images in the main menu - different menues


Thursday, November 09, 2006

Sidax 0.3.7 beta 12

Axapta hangs when trying to exit from the thin client. Added workaround for this bug. Axapta will still hang if you login and then immediately close it, but I think this is a very rare case.

download

AxUnit2 updated

Some errors fixed, Tabax integration.

See AxUnit2 homepage

Monday, November 06, 2006

Sidax 0.3.7 beta 11

download (35k)

  • It can handle a project renaming correctly now

  • Pause button at 'about' tab: you can stop the background processes so sidax doesn't affect profiler



PS: Axaptapedia is online again

Thursday, November 02, 2006

Tabax 0.2.8

download 20K

What's new:

  • Extensibility !!!: Now you can add plugins to Tabax: just create a subfolder \Share\Include\tabax\plugs and place bitmap with the following name _.bmp, where type of menu item, ItemName - name of an existing menu item and tabax will have an additional button with placed image pointing to your menu item (download table structure browser plugin for example)

  • AxSearch: Tabax now have a new input box for invoke AxSearch from it

osalt - the site colleting open source alternatives to various soft

for example, http://www.osalt.com/photoshop - list of open source alternatives to to Adobe Photoshop

Friday, October 27, 2006

Axaptapedia is down II

Just contacted Andrew Jones via email:


Hi Max

Thanks! I'm on holiday for a month so hadn't looked at it. I'll see what I can do from outback Australia!


so it isn't fatal