Saturday, February 26, 2011

Caching the display methods on Forms in AX 2009

AX Forms with many display methods might have some performance issues. To increase the performance of these kinds of AX forms, the display method written in the table methods need to registered for caching.

When the cached method is registered for caching then they perform calculations on fetched data, and then the calculated values are passed to the client together with the data. The calculated values are refreshed on reread. By default, the values are also refreshed on write and create.

A display method can be registered into cache by the following way:

  1. Locate the form that the method is used on.

  2. Expand the Data Sources node.

  3. Right-click the data source that the method is associated with, and then select Override Method > init.

  4. Call the this.cacheAddMethod method after the call to super() in the init method.

    The first parameter for cacheAddMethod determines the name of the method to be cached. The second parameter (set to true by default) determines whether the value of thedisplay method is updated when a record is written to the database.

    The example is as follows:

    public void init() 
     this.cacheAddMethod(tablemethodstr(SalesTable,customerName)); }
    The above method has been overridden in the SalesTable dataSource's init() method. So, by adding this method, this method will registered into client cache and thus the performance of the form with display methods will be increased.

    Note : Only table display methods can be cached. Display Methods written on the form or the form data source cannot be cached and also edit methods cannot be cached.

Monday, February 21, 2011

Effects of disabling a Configuration key for a table in AX 2012

Till AX 2009 version whenever the configuration key is disabled for a table the underlying table was dropped.

But now when you disable the configuration key for a table that is listed in the AOT in AX 2012, the corresponding table in the underlying database management system is not dropped.

Now when you modify a configuration key to disable a table in AX 2012, you must decide whether to manually delete the data that is in the table. External applications and Microsoft SQL Server cubes no longer break when you disable a table. They can continue to read the data from the table because they bypass the Application Object Server (AOS).

So, Folks the effect of disabling of Configuration key for a table in AX 2012 has been changed................................

Wednesday, February 9, 2011

Merge two records from one table in AX 2009

In AX 2009, you can merge two records by using the merge() function in a table. For Example if you have posted a project with different department dimensions and now if you would like to merge two records of department dimension then this merge function can be helpful. The sample code is here as follows:

Dimensions dimensions1, dimensions2;
dimensions1 = Dimensions::find(Sysdimension::Department, 'abc');
dimensions2 = Dimensions::find(Sysdimension::Department, 'def');
dimensions1.merge(dimensions2); // Merge Department dimension 'abc' into 'def' department dimension

Now all the transactions which has abc Department dimension will be changed to def in all the tables and Department Dimension 'abc' will be deleted from the dimension table.

So, Folks...............Now its pretty easy to merge two records............