Microsoft Dynamics Ax developer's blog

Monday, February 06, 2012

DEV_Toolbar: tabax for Ax2012

I am sharing a tabax successor for Ax6 as an example of usage WPF control.

The form uses standard tab control from WPF with a custom template.

Also you can use it as an example of event handling.

The code has a problem which I can not resolve now: if you press a middle or right mouse button on a tab, vontr scrolls to the start - so you can accidentially close wrong tab. Now the workaround provided: if such event occured, event handler uses selected tab instead of tab under click

Tuesday, July 12, 2011

XRef–> DGML

image

Just updated my old sample to produce DGML in addition to .DOT, so now you can view cross-references in VS2010 interactively (filter, rearrange so on). For example picture above shows relations of LedgerVoucherObject.check



Download the job from SkyDrive:

Thursday, June 30, 2011

Tabax successor as an illustration of new dev features of Ax 2012


For some reason I've recreated some subset of tabax in Ax2012. I think it can be an illustration of some new Ax2012 features

Since I have no time for debugging learn winapi in deep I decided to use .NET framework as much as possible.

The most magic part of tabax for me is the code that creates and manages tab control to add images and change size of tabs. That code was written by AndyD from AxForum.

but...

now we have a managed host control and can just use any .NET control we want. I decided to use tab control from WPF.

I took Expression Blend and created my own template for control and implemented several templates for tabs (for example, in the screenshot above you can see blue gradient on editor tabs and darker blue gradient on selected tab related to X++ editor).

After that I copied template as avery big string to X++ method and just loaded it in ManagedHost control.

Since Ax 2012 supports events and they are seamlessly integrated with .NET there was no problems with reacting to user actions.

In addition I've found an example of drag-and-drop for tabs and translated it to X++ - now I can reorder tab pages by dragging them.

As a result I have just one form that uses only plain vannila .NET framework (no custom DLLs) all logic is implemented in X++, visual design is stored in 1 big string literal inside X++ form

Monday, November 01, 2010

the future of F#

The very interesting session from PDC10 related to the future of F# - Microsoft functional-object-imperative variance of OCAML.

They are extending application with "type providers", which allow to extend static type system of F# with dynamically generated types withoun explicit code generation - by implementation of a very simple interface.

I think it can be useful techique to implement business platforms such as LightSwitch (when it come to C#) - LightSwitch authors can just implement type provider for entities and do not generate very much intermediate code.

PS. I think there is aplso enteresting how easy Don manipulates various data in F# interactive

Friday, October 29, 2010

How to open a form in a running Ax client from an external application

Some times ago someone asks me if it possible to open form in running Dynamics Ax application with external code. He don’t want to use AxPath for some reason.
I recalled there is a similar thing in Ax (since version 4.0) – when you receive an event alert message you can click an a link and go to the corresponding alert.
The idea was to reuse alert handling code as much as possible. And I achieved that without changing Ax code at all.
How alert links work?
1. When you start Ax32.exe, it runs the EventDrillDownPoller class, that creates a named pipe with name like “Dynamics\Event\0S-1-5-5-0-686394” (you can use pipelist utility from the SysInternals suite to obtain exact name of your named pipe) where
  • Dynamics\Event\ – is a constant prefix
  • 0 – is a value from the “Drill Down target” field in the “Basic\Setup\Alert\Alert parameters” form
  • S-1-5-5-0-686394 – is a user system session ID
and then time is being initialized, handler of the timer polls named pipe and executes SysStartupCmd descendant when message received.
You can look at \Classes\EventDrillDownPoller\scheduledPoll code to see the details.
2. When you click on the link in e-mail, axhlink.exe protocol handler is executed, it parses url and connects the named pipe obtaining it’s name using “Drill down target” from url and current session id. Then it writes a command to the named pipe.
3. When timeout handler (which was subscribed to the times in 1.) detects there is a new message in the pipe, it just runs a SysStartupCmd and then recreates a named pipe (see \Classes\EventDrillDownPoller\scheduledPoll – unfortunately it uses the current company to detect a drill down target, so if you have different values of the field in different companies ad user changes the current company, you can see it recreating a named pipe with a different name – it can cause mistakes)
So the task is pretty simple
  • Create an autorun startup command configuration file
  • Connect to the named pipe using session id and provided drill down target
  • Write a zero terminated Unicode string with a startup command to the pipe
You can download code example here

Contents:
  • C# sources of sending a message  (command line utility that takes startup command and drop target ID)
  • XML file example
  • XPO with modification for autorun startup command code, adding a parameter to navigate to a specific record (that was additional requirement – it takes table and recID attributes)

Tuesday, August 24, 2010

Seattle

If you live in Seattle or know that area well, could you, please mail me mbelugin@live.ru

Saturday, June 05, 2010

Data/Control flow

I draw Data-Control flow diagrams for better understanding of some process in code. It looks something like that:

dcfd

Legend:

  • ---> – control flow
  • ==> data flow
  • Ellipsis – method
  • Rectangle – data storage
  • Rectangle with rounded corners – class
  • If ellipsis is located on the border of a class – it is a public method

Such diagrams help me later to understand place of some piece of code in some process in system.

It is critical not to draw unnecessary details on a diagram and stay focused on the current task, in other case a diagram will be unreadable. For example diagram in this post is near the edge of readability – lots of intersections are signs of it.

Tuesday, February 23, 2010

Book review: “Microsoft Dynamics AX 2009 Programming: Getting Started”





See the book description on the publisher's site: "Microsoft Dynamics AX 2009 Programming: Getting Started"





When I've received the book, I first thought about beginning of my experience with Ax: in 2003 I worked with BAAN and planned to become a developer for Ax 3. I have decompiled developer's guide and best practice chm, downloaded it to my Sony SL10 and read it for month or two in the Moscow subway during daily commute. I can recall some difficulties I've met and I expect from every book for beginners to go beyond Dev Guide and BP describing these particular areas.



I think the main two topics to learn for every Ax developer are:

  • Dynamics Ax development platform
  • X++ code that implements business logic

Historically, platform was the more clear area docs, but has some dark corners, but business logic was less documented and the knowledge transferred mostly from the code itself, more experienced colleagues, and online communities.

So I tried to search for following topics:

  1. Links to external information sources such as MSDN, Partner Source, internet communities
  2. Data access (Ax have a very specific SQL implementation)
  3. Forms layout
  4. Business logic patterns
  5. Tools and techniques to extract information from X++ code

BTW one of the book reviewers, Harish Mohanbabu, is known by his blog and free Ax tools.

First, the book contains list of online resources links related to Ax, such as blogs, axaptapedia, official sites, so on. The only thing I wish to add it to explain what partner source and what customer source are, and how to get access – it is very frequent question from newbies.

Database manipulation is described in several chapters, the description is easy to understand, full of example screenshots and can be useful for new developers, but I missed description of union joins (which is new to Ax2009 and I haven't seen much usage in the existing X++ code)

Forms-related information is shown mostly by example; you should refer to developer's guide for more detail. I think, it should be better to provide more information on different form layout templates, and some existing form patterns. Anyway, I think, a novice programmer can learn basic form structure prom the chapter and can use some more advanced techniques such as splitters and edit methods.




There are some chapters related to most frequently used business modules, such as inventory, ledger and accounts receivable/payable, each starting with small entity-relationship diagram of basic tables with examples of using Ledger posting framework, adding new dimension, etc..

The topic about tools contains example of usage of cross reference with screenshots, but profiler and trace parser have not been mentioned.

So these were topics that I was interested in due to I remember I had problems with, when I started to learn Ax.

In addition there is lots of information related to:

  • Other platform areas (such as X++ basics, AOT nodes, architecture, File export and import), which have not caused learning problems for me but maybe can cause to other novice developers.
  • Parts of platform I have not used (Application Integration Framework , Enterprise Portal, Webservices) - so I cannot say anything about them

The book contains an example of car rental module (with full sources in xpo's). Chapters of the book describe corresponding pieces of example code and I think it's a good manner to write books for developer.

I definitely recommend the book for novice developers as a good addition to manuals that go with the product and msdn.

Monday, September 28, 2009

fedotenko.info

This is a blog of Dennis Fedotenko - a well known proffessional in Ax functionality and development. He writes rare, but usually his articles can be a key for understanding principles behind ax functionality.

Dennis has a great reputation in Russian Ax community, and now he translated some of his articles to English.

Tuesday, September 22, 2009

San Diego

If you live in San Diego or know that area well, please contact me mbelugin@gmail.com

Это тоже не стоит транслировать на акфорум :)

Thursday, July 30, 2009

Mental framework

Review of the book “Managing your supply chain using Microsoft dynamics ax 2009”

After about 5 years of Ax development I’ve recognized that the model of Dynamics Ax functionality which I have in my brain is like photosynth – some areas, I worked with, covered by consistent pictures, but others are represented by random shots without high level overview.

The majority of existing materials about Ax – like trainings, documentation, so on, use “hands on” approach – little introduction and very detailed description using screenshots, particular sequences of steps in term of buttons, etc.

So I feel that there is a gap between short intros of documentation and very detailed contents (for example Russian docs contains of 2 volumes >1000 pages each).

That’s why I was very interested when Dr. Scott Hamilton sent me kindly the book, which was written to give “mental framework for putting together the details” learned from various sources . So below are my impressions.

The book contains 426 pages, and most of them are text description of Ax functionality: no screenshots, no concrete steps – just text, tables and business process flowcharts. Thus, the information density is quite high.

The book consists of 15 chapters, each dedicated for some functional area. All chapters are in scope of SCM (you can see TOC at Amazon). Each chapter contain description of a functional area, case studies and executive summary.

New features of Ax2009 (such as sites and purchase requisition) are reflected.

What I like about the book

  • The book met my expectations about abstraction level it have no redundant details, which can be obtained from products docs and training, and contains enough for making mental model of SCM modules.
  • There are lots of tables showing how ax behavior depends on parameter combinations – it helps to understand the space of different implementation scenarios.
    table example
  • As I mentioned before the most important features of ax2009 are described

What can be done better

  • Some case studies are very brief – I’d prefer to include more detailed business scenarios and more implementation details. (But maybe I should read some book about common business practice instead – could you recommend me such a book?)

Overall impression

I’d buy the book if I haven’t one. I recommend it for everybody who want to have a consistent view of Ax SCM functionality.

PS. there is also a new book by Dr. Hamilton - Managing Lean Manufacturing using Microsoft Dynamics AX 2009

Saturday, May 30, 2009

AxForm.info for English-speakers

AxForum.info is the one of the largest Russian communities related to Dynamics systems.

Though it has a section in English there are lots of info in Russian there. Some of English speakers read the forum via online translators.

If you have and idea how to make AxForum.info more suitable for English-speaking people, please post to that thread

Thursday, May 21, 2009

Bulgaria

Does anybody from bulgaria reading this blog? Please, contact me mbelugin@gmail.com

вот это не надо транслировать на аксфорум :)

Search for C#

It is obvious for somebody, but it can help somebody novice.

Since version 4 Dyanmics Ax requires .NET framework installation, so you can rely on the fact that .NET FW exists. There is also constantly improving intargetion of .NET in X++, so you can use .NET framework as a huga library of various utilities. For example, Ax uses System.Text.RegularExpression for checking e-mail format.

So sometimes, you can search the internet for code snippet, performing some task, you need, but if you type "http .net" you can get lots of irrelevant results since .net is an often part of web page address. Type "http C#" instead and you probably get what you want.

SQL Server 2008 R2 what's new

Interesting announce of new features in SQL Server 2008 R2

Friday, January 09, 2009

Friday, November 07, 2008

AxPath plugin for Tabax which works with Ax3, Ax4, Ax2009

Now you can download AxPath.dll (with sources) which works with Ax 3, Ax 4, Ax 2009. Previously it worked only if Ax3 was installed.

Ivan fixed it to work with Ax2009, now I have extended it to probe registry keys for Ax2009, Ax4, Ax3 (in that particular order) and work with the version found first.

If you do not know what AxPath and Tabax are - look at http://axaptapedia.com/AxPath, http://axaptapedia.com/Tabax

AxPath plugin originated by AndyD from http://axforum.info

Thursday, September 25, 2008

First experiments with XRefs and MSAGL



Tryng to get more visual represenation of cross references using MSAGL (Microsoft Automatic Graph Layout)

This is only calls inside Tax class. Methods which are called from external places are merked with ">". Methods ahich are called from descendats - with "*"

view complete xps

Simple job generates .dot file from xrefs which can be read my MSAGL.

There is also well known graph layout package - graphviz. (.dot it it's native format)

Friday, July 11, 2008

Sidax & Tabax for Ax2009

Here are first betas for the utilities that works under Ax2009. Tabax now can works with forms outside main Ax window.

download

Tuesday, July 01, 2008

How to hide Content Pane in Ax 2009

Here is a small job, which hides content pane in Dynamics Ax 2009. Content pane can be useful for end users, but when you develop something in can be irritating to see it oon top of all windows every time you click on menu item. So here is a small solution. I plan to add this feature to the future Tabax for Ax 2009


static
void TEST_HideContentFrame(Args _args)
{
#WinApi
HWND contentPane = WinApi::findWindowEx(
WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', ''),
0,
'ContentFrame',
''
);
;
if (contentPane)
WinApi::ShowWindow(contentPane, #SW_HIDE);
}

Wednesday, June 18, 2008

https://community.dynamics.com


 

Here is announce:

Within the next few weeks you will begin to see the Microsoft Dynamics Community pages located at http://www.microsoft.com/dynamics/community, moving to a new location at https://community.dynamics.com. We are making this move in an effort to streamline the accessibility of all Microsoft Dynamics communities and make the user experience of interacting with community experts and your peers much easier. The newsgroups as you see them today will still be intact, but the web pages which you use today to access them will be different. Plus you'll see more streamlined content and future functionality additions, such as networking tools!


 

To get a jump start on the transition, I would encourage you to register on the new site TODAY – once you do, you can begin to interact with our non-technical role based communities which reside there today for Finanse, Sales & Marketing, and Customer Service professionals.


 

--

Liz Hallen

Online Community Product Manager

Sunday, April 27, 2008

Book review: “Quality Assurance for Dynamics AX-Based ERP Solutions”

As some other bloggers, I have received the book for review. Here are my impressions…

This book is written about several aspects of quality assurance in Dynamics Ax implementation projects. I think the main focus is on customizations development because most topics related to it.

Quality in the following areas is covered by the book:

  • Code
  • User interface
  • Security
  • Performance
  • Organizational

Detail level differs from topic to topic: for example code topics contain introductory material and detailed BP rules, user interface topic consists of very concrete checklists and security aspects are showed almost only as general word about trustworthy computing. The book is not very thick (~150 pages), but contains information only in textual form (text, tables, lists), so information density is higher than in most modern books filled with screenshots and code samples.

My overall impression - good enough as introductory book. It can be useful if you are:

  • Novice developer and want to have overview about what quality in dynamics ax means
  • Some kind of manager who want to build a development process with focus on quality (you can borrow some rules and checklists)
  • Some other non-developer who wants to have overall outline about quality in Ax

I think, there are some topics, which should be covered by the future books of such direction, but haven't been covered by this book:

  • Administration issuer
  • Functional setup issues

Other topics (such as end-user training) which are parts of real implementation projects but haven't been represented in the book

Thursday, March 27, 2008

Sidax 0.4 b 6 will show you what groups can access selected main menu items


download (85K)

What's new:

  • multiple selection of main menu items

  • new item named "Show access" in the main menu item's context menu. If you choose this item all groups which have access to that item will be output to infolog

Monday, March 24, 2008

BeauSQL -- SQL beautifier

Download: binaries, sources



The purpose is to make SQL traces code more structured and core readable.

This tool consists of two parts:

  • DLL, which is written in Haskell - a very interesting functional programming language, and it do actual work of parsing and pretty printing

  • Small class in Ax which is a thin wrapper for the DLL and button to place in SQL trace form.


This is the first version, it is very experimantal and tested under Ax 3 only.

PS. Some code was stealed from cs4 tool for BAAN

Tuesday, March 18, 2008

How to manage rights by code

Some times ago I nedd to copy 8 security groups and remove access to some menu items in these new copies. I wrote a job for that purpose and now I've placed it to axaptapedia here.

Tuesday, January 29, 2008

Brainbench results





Brainbench is a site dedicated for online testing. There are some free tests which I have done some time ago. My transcript id is 6941773

Wednesday, January 23, 2008

Tweaking google desktop gadgets

Google Desktop has a calendar gadget. But it use american style: week begins with sunday and there are only english letters in title. Here in Russia week starts with monday. So I was interested to localize that gadget. And it was easy. SDK contains designer and good examples, and gadgets are only combination of XML and javascript, so they can be hacked by anyone who knows that technologies. If you are interested in localizing that gadget to your language, or have any ideas of integrating google desktop gadget technology with Ax - just reply to this post.



download this gadget

Thursday, January 17, 2008

Trace Parser small bug

Trace Parser is a new tool for profiling Dynamics Ax code. Unlike profiler, which makes execution of the code about 30 times slower, TraceParser takes extremely low resources - 4% according to Alexey Eremenko blog)

But since it is in the "beta" stage, there are some problems with usability and stability.

For example, when I run the "trace summary" menu item on my trace I've got an exception. It seems (thanks to reflector) the cause is in SqlTimeBreakDown function in SQL server Trace Parser database.

When I add condition to exclude division by zero, it results in empty
grid instead of exception.

This is the fix:

if @SQLTime>0  -- <<<<<<<<<<<<<<<< the fix
begin
INSERT INTO @BreakdownInformation
SELECT (sum(PrepDuration) * 100)/@SQLTime [% of time in SQL Prep],(
sum(BindDuration) * 100)/@SQLTime [% of time in SQL Bind],
(sum(RowFetchDuration) * 100)/@SQLTime [% of time in SQL Row Fetch],
(sum(ExecuteDuration) * 100)/@SQLTime [% of time in SQL Execution]
from SqlQueryInstance
WHERE traceId = @Traceid AND sessionid = @sessionid
end -- <<<<<<<<<<<<<<<< the fix
RETURN

Wednesday, January 16, 2008

Syntax highlighting of X++ code in your blog or site

1. Download highlight.js archive
2. Unpack archive and place it on your site
3. Аdd the following lines at start your html

<script type="text/javascript" src="highlight.js"></script>
<script type="text/javascript">
initHighlightingOnLoad('axapta');
</script>


(or, add html/javascript block with that content in the blogger.com template editor. If you use blogger, you should replace path to the script with full path to site where you uploaded the script like "http://belugin.info/highlight.js")

4. Attach the sample.css stylesheet to your page or add it's contents to the "style" tag of your blogger template

5. Post your code snippets like this:

<pre><code class="Axapta">
// your code here
</code></pre>


PS. You can also use export.html from the archive and skip all steps except 4 - just paste a generated code to your page

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.


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.

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

Tuesday, October 24, 2006

Friday, October 20, 2006

Tabax, Sidax and KR3

Just updated Tabax for work with Kernel Rollup 3 - see homepage for details

Sidax has been updated also:

  • MainMenu is cached now at first load - so you can work after Sidax start immediately (go 'about' tab for cache refresh button)

  • 'House'option: you can add any number of windows to the sidax: for example I prefer to run current project window inside it

  • When you click on minmized window in the 'window' tab of sidax it will be restored

Monday, October 09, 2006

Sidax 0.3.7 beta 5 -- AOT included

download latest beta of sidax. Changes

  • AOT included!!! thanx top IPv6 from AxForum: all problems with built-in AOT was resolved so you have a sidax with AOT in it

  • X++ calculator changes
      It can output objects and containers

      It gets sidax as parameter (try to run sidax.collapse())

      Small other changes


Tuesday, September 12, 2006

[ann] Sidax 0.3.6 -- X++ calculator; Go component

Download from axaptapedia

X++ calculator -- evaluate X++ expression or run X++ statement


Go component -- enter component name and choose concrete component from list. You can enter path like "\Data Dictionary\Tables\VendTransOpen"

Wednesday, August 30, 2006

AOT VSS Integration

History window
Just uploaded the project for integration Visual SourceSafe with Axapta to store AOT items.

We've used it for our current projects and it help us to find what and why changes was made.

I think it will be good to use something other than VSS, and it can be done - tool is based on the abstract classes, but now i have only VSS implementation.

Friday, August 25, 2006

GenerateParmMethods extension v2.beta

Just uploaded small fixes to the extension.

Read about the anges at axaptapedia, then download it if you like

Saturday, July 15, 2006

ATTN!!! SQL Injection possibility when using literals in queries

I've found a huge security hole in Ax 3.0 SP 4 + MS SQL Server (i don't know about other versions, but i think it is possible with other versions too)

If you have the following database connection options switched on, users can execute any SQL Server query using user defined filter.

So switch off:

  • Literals in join queries from forms and reports

  • Literals in complex joins from X++



Dont't use forceLiteras in production environment.

It can affect performance but will protect your data

Thursday, July 06, 2006

On toolbars

Palle Algemark has recently posted about toolbars imitation in Ax:

Custom toolbars in AX,
Activating a custom toolbar

I have something to add:
  • if you want to do something with selected AOT items - use LastAOTSelection class (it's an iterator for last selected AOT items)
  • if you want to do something with active form: sit on timer, get last active form from info class (method setLastActivatedForm),remember it it's not your toolbar form and use remebered value on button clicks