Other recent Dynamics AX Blog postings

Sonntag, Dezember 23, 2007

Merry X-mas!

A very merry christmas to all my readers and a happy and successful New Year!

Samstag, Dezember 22, 2007

Don't trust the execution plan within AX

The other day I was attending a lesson concerning the new Dynamics AX trace parser tool. With that tool (you can download it from Partnersource and Customersource, eventually), you can analyze the trace files that are generated if you activate the tracing options (both on the server and the client side).

With the tool, you can analyze all the information that is sent between the client, the server and the database. Another point that was pinned out was that the execution plan you see in Dynamics AX (if you trace long running queries in Dynamics AX, you can click on "Execution plan" and see which execution plan is used by Dynamics AX).

Well, the execution plan shown is not the one that was actually used by the database. It is the execution plan that would be used right now, the moment you clicked on the button.

So, don't trust the execution plan for the queries run, but you can use it for future queries, so you can see if a new index will be used or not.

Dienstag, Oktober 30, 2007

Catching keystrokes and the task() method

As a follow up to my previous post about catching keystrokes in Dynamics AX, I received some comments telling me I should use the task() method on the form.

Well, the task() method can be used to catch some keystrokes (most of them described in the Macro Task in the AOT), but this is only some "system keystrokes", as I would call them.

So, you can catch Alt-F9 (delete record) or F1 (Help) or copy and past (Ctrl-C/Ctrl-V), but you cannot catch e.g. other function keys with it or keystrokes defined by yourself like Alt-S or Ctrl-S.

Take a look at the Task macro in AOT and you'll get an idea what kind of keys you can catch with the task() method.

Freitag, September 28, 2007

Clear SQL Cache

When you do performance tests in Dynamics AX, you often want to clear the SQL cache so you can be sure that all data must be re-read from the disks.
If you want to clear the SQL cache, execute these 3 lines in a query window:

CHECKPOINT
DBCC DROPCLEANBUFFERS WITH NO_INFOMSGS
DBCC FREEPROCCACHE WITH NO_INFOMSGS

Donnerstag, August 30, 2007

Label for query range cannot be modified in AX 5.0

I've now checked this function and I have to say that it still doesn't work. If you change the label for a query range, AX 5.0 will give you an error message, too.

This is a follow up to a previous post: http://axaptafreak.blogspot.com/2007/07/label-for-query-range-cannot-be.html

Dienstag, August 28, 2007

Catching keystrokes or function keys

The last days I've been struggling to find a way to catch keystrokes in a form to create keyboard shortcuts for the users. Well, I didn't succeed so far but I found something concerning function keys.

In the shop floor control module, some forms use functions keys to control the form buttons (e.g. the form "JmgRegistraion"). I invested some time in it and it seems to me that the form doesn't really catch the keyboard event. The form uses a third party DLL and if you press F1, it will send the key "1" to the keyboard buffer. The buttons in the form have the numbers 1-9 as their first letter in the button text (property "Text" for the button).

So, you press F1, the DLL sends the key "1" to the buffer and AX then connects it to the button that starts with "1".

Well that's not really what I was looking for (and moreover, it will not work for F10, F11 and F12. It doesn't work for those keys in the mentioned form.)

But it's a start.

Donnerstag, August 02, 2007

Activating query tracing for all users

Sometimes when you are tracking performance (or other) problems, you may want to activate the long running query tracing for all users. Here is a little job that will do that. Beware: you have to activate trace settings on your AOS server, unless most of the queries will not be caught.


static void Set_SQLTrace_AllUsers(Args _args)
{
#LOCALMACRO.FLAG_SQLTrace (1 << 8) #ENDMACRO
#LOCALMACRO.FLAG_TraceInfoQueryTable (1 << 11) #ENDMACRO

boolean set;
UserInfo userInfo;
;

set = true;
ttsbegin;
while select forupdate userinfo
{
userinfo.querytimeLimit = 1000;
if (set)
{
userInfo.DebugInfo = userInfo.DebugInfo | #FLAG_SQLTrace;
userInfo.TraceInfo = userInfo.TraceInfo | #FLAG_TraceInfoQueryTable;
}
else
{
userInfo.DebugInfo = userInfo.DebugInfo ^ #FLAG_SQLTrace;
userInfo.TraceInfo = userInfo.TraceInfo ^ #FLAG_TraceInfoQueryTable;
}

userinfo.update();
}
ttscommit;
}

Dienstag, Juli 24, 2007

Label for Query Range cannot be modified (still)

In a query range (open AOT, Queries, any query, any range field), you can specify the property "Label". So you could display another label than the standard field label to be used in a query.

Unfortunately, if you put a label into the query range, Ax will give you an error "Field xxx does not exist", where "xxx" is the label you wanted to use.

This error existed in Axapta 3.0 and it still in exists in 4.0. (Maybe it also existed in 2.5 and back, so it could have a long bug history...)

As soon as I get the time to install my Ax 5.0 CTP application, I will check if the error is there as well and will tell it to the MS guys, so they can fix it for the next versions.

Dienstag, Juni 19, 2007

Automatically open grid filter when opening form

In some forms it may be convenient that the grid filter (new in Ax 4.0) is activated automatically. If you want to get that behaviour, just add one line in the form's run method, just after the super() call:

this.task(2855);

So, your run() method should look like:


public void run()


{


..... // some programming lines....
super();
this.task(2855);



}

Montag, Juni 04, 2007

Be careful when resetting your usage data

First of all, my apologies for not having written anything in the last weeks. But I'm really busy with my project at the moment....

But here's another thing for you:
in Dynamics AX 4.0, a "Favorites" menu was introduced. You can drag a form to your favorites pane. Then you will be asked to give it a name, and: you can add a saved query to it. With that, you can easily make favorites the open the forms filtered on the data you just need.

But there's another thing: as long as your system is still in change, everybody recommends that you delete your usage data from time to time (in User/Options).

But what happens to your favorites if you delete all your usage data?
The answer is: you'll get an error message. The system will tell you that it cannot find your saved query anymore. So, the whole work saving your queries and making your favorites is lost.

A small little addition to the method "reset" in the form "SysLastValue" will help you avoid that.

Add the line

&& _sysLastValue.recordType != UtilElementType::UserSetupQuery;

in the "delete_from" statement.

So, the deletion will not delete your saved queries.
Things that could be improved:
  • Only skip queries that have been saved with a name
  • Only skip queries that are used for a favorite menu item

Mittwoch, April 18, 2007

Microsoft MVP, finally !

With some days delay, I can now tell you that I have received the prestigious Microsoft MVP (Most Valuable Professional) award.

There was a problem with my email address so I didn't receive the award mail from Microsoft, but now the issue was solved and I can tell you very happily that I am MVP for Dynamics AX.

I want to thank all my fellow Dynamics AX geeks and everybody I know and who know me via my blog. Thanx to all who took part in my MVP nomination.

It was always my intention to share my knowledge to increase the value of Ax(apta) to all its users. Another thing was of course that the better your name in the community, the more likely you will get answers yourself in case of a problem. So another thanx to all the people that helped me out when I needed it myself.

I will continue to share my knowledge via my blog, so make sure you keep updated !

Sonntag, April 15, 2007

User interface changes in SP1 for Dynamics AX 4.0

One change in the AX user interface I just found out: if a user has no access to a button, the button is not displayed anymore in the form (the button has a security key assigned and the security key access is given to a certain user group).
Before SP1, the button was just greyed out and not clickable.

Another change in the user interface: every button in a form gets a keyboard shortcut which is displayed in parentheses ().

And: there is not "Favorites" button anymore. You have to activate/deactivate the favorites window via the "View" menu.

Donnerstag, April 05, 2007

Happy Easter with Tabax for DAX 4.0

I want to wish everybody Happy Easter and my present for you from the easter bunny is: Tabax is now working with Dynamics AX 4.0.

Max Belugin did a fabulous job in implementing a tabbed interface for Dynamics AX 3.0 and 4.0. There are 2 versions available: TabaxLite for end users and Tabax for developers and power users.

The homepage for Tabax is http://www.axaptapedia.com/Tabax but unfortunately the latest version (0.3Beta5) is not available yet. But: have an eye on it!

Freitag, März 30, 2007

DAX 4.0 Clustering question

Rob asked me in a comment to a previous post (Link):

"Wouldn't the session manager take care of directing a request to a certain
AOS ? (I.e. load balancing).When not using the session manager, how is
determined which AOS in the cluster to use ?"

Well: I can only assume that it makes the same as Axapta 3.0 (but better): the client tries to connect to all AOS servers in it's configuration. Each AOS server tells the number of users connected, the client connects to the one with the lowest user count.

Hmm, if anybody from Microsoft is reading this and knows how it works, please give us some feedback.

Freitag, März 16, 2007

Send message to online user in Dynamics AX 4.0 (quick & dirty)

I am missing the functionality to send messages to online users that existed in Axapta 3.0 and is now gone. Well, I thought you could use the "Alert" functionality introduced in DAX 4.0.
What to do:
1. make sure the user options are configured correctly (that means: set "Time poll interval" to 1 minute, set "Show popup" to "For all event rules")
2. make a button in the online user form that will open a dialog where you could enter your text
3. send the message to all users selected in the online user form datasource

Here is a little job that creates an alert for a user. Remember this is a quick & dirty solution, so there are some drawbacks:
* you will get an error in the alert form on the second tab
* the message will only be displayed about 15 sec and disappears afterwards (you can check FRM EventAttentionGrabber to change that. Check methods fadeIn and fadeOut for variable opacity. This should give you a hint on how to display the form longer)
* the message will stay as unread until the user marks it as read

So you see there's lot of room to improve it... 8-)

Remember also to replace the "curuserid()" with the user id you want the alert to be sent to.

This is merely meant as an idea on how you can achieve sending messages to a user.

static void sendAlert(Args _args)
{
EventInbox inbox;
EventInboxId inboxId;

inboxId = EventInbox::nextEventId();

inbox.initValue();

inbox.ShowPopup = NoYes::Yes;
inbox.Subject = "Message to online user";
inbox.Message = "Message you want to send to user";
inbox.SendEmail = false;
inbox.UserId = curUserID();

inbox.InboxId = inboxId;

inbox.AlertCreatedDate = systemdateget();

inbox.AlertCreateTime = timeNow();

inbox.insert();

}

Donnerstag, März 15, 2007

Roadmap for Dynamics AX

Googling around for more info on Dynamics AX 5.0, I stumbled over this interesting link: http://blogs.zdnet.com/microsoft/?p=325 which tells us the following scheduled dates:

* Dynamics AX 4.0 Service Pack (SP) 2: Summer 2007

* Dynamics AX 4.0 extensions, including CRM integration and Lean Manufacturing methodology integration: Q4 2007

* Dynamics AX 5.0: Second half of 2008

* Dynamics AX 6.0: 2010

Mittwoch, März 14, 2007

Dynamics AX 4.1 renamed to Dynamics AX 5.0

I've just read on the UK partner website that AX 4.1 will be renamed to AX 5.0. The scheduled release date is Q1/2008 (well it says 2008 but I've read somewhere that it could be released in Q1). There should be more info on Partnersource, but I don't have access to that.
Link: https://partner.microsoft.com/UK/40032627

Donnerstag, März 08, 2007

Using global search for virtual tables

The global search is a feature in Dynamics Ax 4.0 which allows you to search for a string in several tables (like a full text search). You setup some tables and fields to be searched in and start a data crawler that collects the data to be searched.

Now, if some of your tables that are searched belong to a virtual company, the data crawler will mark them as records of the company it is running in. That means that if you want to search for your virtual data from a different company, it will return no results.

Example: you have the companies xxx and yyy and a virtual company vir. Table CustTable is virtual (dataareaid of the records is vir). The data crawler runs in company xxx and will mark the CustTable records as belonging to company xxx .
Now, if you start a search in company yyy, it will not find the Custtable records as they seem to belong to a different company. You could only set up a second data crwaler for company yyy which would collect exactly the same records and you would need to store them twice in your database.

The following changes will circumvent that: you will be able to see data from different companies. There are some drawbacks, however: you will be able to see search results from your "data crawler company". But it the data is from a non-virtual table, you will not be able to see the results. But I hope it will lead you to a way where you can make your own modifications to get the best out of the global search. Remember: all changes you make are at your own risk.

Here are the changes you have to do:

Class SysGSSearchStart, method startSearch
comment the following line:
infolog.add(Exception::Warning,"@SYS98793");

With that, there will be no warning if you are working in a company where the data crawler is not running.

Class SysSearch, method search:

at line 28, just after "if (!searchname)" add:
select firstonly RecId from sysSearchName
where sysSearchName.Design == 'SDS_xxx_default'
&& sysSearchName.LanguageId == this.languageId();

if (!sysSearchName)


replace the xxx in the 'SDS_xxx_default' with the company id where the data crawler is running.

Class SysSearch, methods searchWord and searchExactWord:

at line 11, replace the "where sysSearchName.Design == this.design() &&" with:
where (sysSearchName.Design == this.design()
sysSearchName.Design == 'SDS_xxx_default') &&

again, replace the xxx in the 'SDS_xxx_default' with the company id where the data crawler is running.

Class SysSearchDoDataSearch, method buildItemListXML:

at line 11, after a while select indextable from sysDataSearch block, add the following code:

changecompany('xxx')
{
sysDataSearch = null;
while select IndexTable from sysDataSearch
{
dictTable = new DictTable(sysDataSearch.IndexTable);
if (dictTable.rights() != AccessType::NoAccess)
searchTableMap.insert(dictTable.id(),0);
}
}
sysDataSearch = null;

Replace 'xxx' with the company id where the data crawler is running.

At line 77, after select sysDataSearch where sysDataSearch.SearchGroupId == m_eSearchGroupDef && sysDataSearch.IndexTable == tableid; add the following code:

if (!sysDataSearch)
{
changecompany('xxx')
{
sysDataSearch = null;
select sysDataSearch
where sysDataSearch.SearchGroupId == SearchGroupDef
&& sysDataSearch.IndexTable == tableid;
}
}

Replace 'xxx' with the company id where the data crawler is running.

Dienstag, März 06, 2007

Ax 4.0 SP1: new clustering functionality

In Ax 4.0 SP1, the new "session manager" for AOS clustering was introduced (so you do not need NLB anymore). This, however, means a new single point of failure, because if the session manager crashes, clients will not be able to login to AX anymore.
The good news, though, is that you do not need the session manager!

Make the following setup: several instances of AX, mark all with the flag "Make this AOS instance part of the load balancing cluster". In the client config, add all your AOS instances on the various servers. The client will connect to one of the available servers. And the good thing is: this setup will work, even if one or some of the AOS instances are not running (this did not work in Axapta 3.0: there the client would have said that it cannot connect to the AOS server).

What I do not know right now: what do I need the session manager for?

Donnerstag, März 01, 2007

Ax 4.0 SP1: Client still quits if AOS stops

I 've read somewhere that it might be possible in Dynamics AX 4.0 SP1, using the new "Session Manager" for AOS, the following could be working:
the client logged in on Server1, the server stops and the client automatically connects to Server2 (both in the new styled AOS clustering using the session manager).
Well I just tested it and it's not working like that. If the server on which the client logged on has a problem (e.g. service stops), the client is still kicked out of Dynamics AX.

Dienstag, Jänner 23, 2007

XPO for complexity analysis add-in

Anders Tind Sørensen has sent me the xpo for the complexity analysis add-in to the best practice checks and you can download it here: http://www.axaptapedia.com/... on your own risk.
This is a follow-up to a previous post: http://axaptafreak.blogspot.com/2006/10/extension-of-best-practice-checks.html