Help wiki is now available for technical preview of new "Microsoft Dynamics AX" aka AX 7. It can be accessed from the following link
https://ax.help.dynamics.com/en/
The wiki details how to sign up for AX 7, get an instance running either in cloud or get a vhd to run locally, technical changes and a lot more.
This posting is provided "AS IS" with no warranties. Use code at your own risk.
Friday, 18 December 2015
Friday, 17 April 2015
Caching display methods
A display method is usually used to fetch data from another source or to perform calculations. It is recommended to create them on Tables. Once these display methods are used on forms, these are called every time the form is re-drawn. However if the field/group/tab which uses this method is hidden the display method is not called. For performance reasons the display method should be cached. This way system calls the method once and stores its values reducing unnecessary calls to server.
Recently we had a performance issue and on investigation found out that apart from the actual cause of problem, some display methods are not cached. So we followed the recommendations and cached the methods using attribute [SysClientCacheDataMethodAttribute(true)].
Every thing was fine until a user complained about performance using a specific customer. We investigated again and found out that one of the display method that we cached in previous findings is causing the issue. It had a IF condition and was doing some heavy calculation in certain cases only. But why this was not a problem before. On further investigation we found that the field on form which was using this display method was hidden. So when the display method was not cached it was not called by system.
However after caching it, upon opening of the form, system was calling the following method
Our solution to problem was to remove the hidden field from the form.
This posting is provided "AS IS" with no warranties. Use code at your own risk.
Recently we had a performance issue and on investigation found out that apart from the actual cause of problem, some display methods are not cached. So we followed the recommendations and cached the methods using attribute [SysClientCacheDataMethodAttribute(true)].
Every thing was fine until a user complained about performance using a specific customer. We investigated again and found out that one of the display method that we cached in previous findings is causing the issue. It had a IF condition and was doing some heavy calculation in certain cases only. But why this was not a problem before. On further investigation we found that the field on form which was using this display method was hidden. So when the display method was not cached it was not called by system.
However after caching it, upon opening of the form, system was calling the following method
<Table Name>::executeCachedDisplayMethods
This method was calling all the cached display methods of the table regardless of whether the field for the display method is hidden or not. This behavior is different from when the display method is not cached.Our solution to problem was to remove the hidden field from the form.
This posting is provided "AS IS" with no warranties. Use code at your own risk.
Labels:
AX2012,
Cache,
Display Method
Friday, 3 April 2015
Connect to a desired AOS in load balanced AOSs
If you have a set of clustered AOS and you want to connect a specific AOS, use the following command line parameters
AX32.exe -loadbalance=0 -aos2=<AOS SERVER NAME>:<AOS PORT>
This posting is provided "AS IS" with no warranties. Use code at your own risk.
Monday, 2 March 2015
.NET Cast Type Name not found error
Last week I was trying to fix a bug in custom code where we import the POs. The bug was in the following method.
This posting is provided "AS IS" with no warranties. Use code at your own risk.
protected AnyType getData(int _position, Container _data = currentData)
{
str data = conpeek(_data, _position);
data = strRem(data,'"');
if( _position == str2int(#13)
|| _position == str2int(#14))
{
data = this.formatDate(data);
}
return data;
}
The fix for the bug was to check for another position #07 and convert the data to date format. So I changed the code to followingprotected AnyType getData(int _position, Container _data = currentData)
{
str data = conpeek(_data, _position);
data = strRem(data,'"');
if( _position == str2int(#13)
|| _position == str2int(#14)
|| _position == str2int(#07))
{
data = this.formatDate(data);
}
return data;
}
Note the position of #07 in the if statement. The compile was fine however when I generated IL it gave the following error. Incremental or full IL, both produced the same error.CIL generation: Error: .NET Cast Type Name not found. Type System.String found on the stack. This code in Class/Table: POImportService, Method: getData may not work in CIL run time.
I moved the position of #07 as shown below and the error disappeared.protected AnyType getData(int _position, Container _data = currentData)
{
str data = conpeek(_data, _position);
data = strRem(data,'"');
if( _position == str2int(#07)
|| _position == str2int(#13)
|| _position == str2int(#14))
{
data = this.formatDate(data);
}
return data;
}
Not sure why IL does not like the #07 line to be the last one.This posting is provided "AS IS" with no warranties. Use code at your own risk.
Wednesday, 18 February 2015
Trace Parser command line paramters
If you want to automate trace file open/import, Trace Parser supports command line parameters.
Usage: Microsoft.Dynamics.AX.Tracing.TraceParser.exe [options]
/log=[filename] - Used to log messages t the specified file.
/register - Register a new or existing database. Options:
/server=[hostname] - Name of the SQL Server. Default to localhost.
/database=[database] - Name of the SQL Database
/(open|import)=[filename] - Imports a Trace File. Options:
/id=[id] - TraceId if the file is already imported.
/consoleonly - Run in console only.
This posting is provided "AS IS" with no warranties. Use code at your own risk.
Labels:
AX2012,
Trace Parser
Subscribe to:
Posts (Atom)