Showing posts with label Dynamics AX Forms Datasources. Show all posts
Showing posts with label Dynamics AX Forms Datasources. 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 !!

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 !!!

Thursday, February 16, 2017

Multiple form datasources and their LinkType property values (Passive, Delayed, Active, Inner Join etc.) explained - Dynamics AX

While development and customization of AX forms we often need to add multiple datasources on the form. But there is only one main data source on the form. Remaining are joined to the main or any of its dependent data sources.

Form data source 















For adding multiple data sources we need to set following properties:

Join Source: The data source to which chile (current) data source will be connected.
Link Type: Link type will specify the type of link that will be established with parent datasource.

Link type has following options:

Active: Active link type update the child data source without any delay when you select the master table record. This has performance problems when dealing with multiple records.

Delay: It is same as Active link type except it doesn't update the child data source immediately, it updates the child datasource when child table record is selected or set focus.

Passive: If this property is used as link type then the child datasource will not update automatically. You need to update child datasource manually in code by calling its executeQuery() method.

Inner Join: Inner join shows the data of child data source that matches the parent data source. Its like join of SQL.

Outer Join: It will return all parent records and matched child records.

Exists Join: It works like inner join but the difference is it only returns parent table records not the child table records.

Not Exist Join: It works completely opposite to Exists Join. Returns only those rows of parent table which are not matched with child table.

Hope it helps !!!