Showing posts with label Performance. Show all posts
Showing posts with label Performance. Show all posts

Thursday, February 23, 2017

Difference between Refresh(), ReRead(), ReSearch(), ExecuteQuery() on Form Datasource

While working on Dynamics AX forms, we come across using data source methods like Refresh, ReRead, ReSearch, and ExecuteQuery(). These methods often confuse the developer.

Following is an explanation of what their purpose is and when to use these methods:

Refresh(): Refreshes the user view with what‘s stored in the caches. This does not touch the DB.Use this after any form change has been made through code.

ReRead(): Fetches only the current record from database and does not re read the complete DataSource.Use this when you need to update only the current record after modifying any value.

ReSearch(): Will execute the same query again and fetch all the results from the database.Use this if you need to get the current most data from database.

ExecuteQuery(): Will run the query again just like research does but it will also take any query changes into account.Use this if you have modified the query on run-time and need the updated results according to the new query.

Thanks, hope it helps !!

Monday, February 20, 2017

Temp Table pros and cons - Dynamcis AX

Most of the time we require Temp Tables in our solution. This post is about temp table's capabilities, limitations and life-cycle.

When we use temp tables, axapta kernel creates a table in SQL temp database with a different name.

Capabilities:

  • Can be joined with normal tables in X++
  • Can save Data Per Company
  • Can be used in Enterprise Portal development
  • Can have foreign keys from other tables
  • Can have Indexes

Limitations:
  • Cannot be a Valid Time State Table
  • Cannot have Delete Action
  • No Record Level Security (RLS)
  • No View support (cannot be used in views)
Life-Cycle: When is temp table dropped from TempDB?
  • Table buffer goes out of scope
  • Restart of AOS service
  • Restart of SQL service
  • Closure of AX32.exe

Hope it helps !!!

Sunday, February 19, 2017

Table inheritance in Dynamics AX 2012

Microsoft Dynamics AX 2012 supports table level inheritance.
A table can extend from another table if its SupportInheritance property is set to Yes. Otherwise the table cannot extend from another table.

When a table A is created:

  • It is default inherited by Common table, this value cannot be seen in the table Extends property
  • When a variable (or buffer) of table A is declared, this variable inherits class of xRecrod by default
Cannot inherit from any other table

















You need to set Extends property of a table to specify its parent table. When a table A inherits from table B:
  • Table A will contain all the fields of table B but you cannot see them in AOT view
  • When a variable (or buffer) is declared of table A, it will access all the methods of table B and methods available in xRecord class
Table has inherited from another table


















Hope it helps !!!

Friday, February 17, 2017

How to improve performance of Display Method - Dynamics AX


Display methods are very useful but they affect the performance of your solution.

AX gives a mechanism to enhance the performance of display method by caching the display method.

There are two options to do that:

1) Override the FormDatasource init() method and add the following code:

    public void init()
    {
          super();
      
          DataSource_ds.cacheAddMethod(tableMethodStr(Table, displayMethodName), false);
    }


2) AX 2012 has also given a feature called Declarative Display Caching

    This allows us to enable caching by setting CacheDataMethod property to Yes, No or Auto.

Improving quality !!!