axaptax++dynamics-ax-2012-r3

Use cacheAddMethod for methods of datasource AX2012


There is a form have two display methods. So form load is so slowly. I searched and found this way;

public void init()
{
    super();
    MyTable_DS.cacheAddMethod(tableMethodStr(MyTable, dispCreditBalance));
}

but my display methods not in table methods node. My methods under form -> datasources -> table -> method node. So tableMethodStr can't see my methods.

How can use this cacheAddMethod in this situation?


Solution

  • Caching of form display methods is not supported. You may try to enable the "CacheDateMethod" attribute of the form field, but I expect it will not work.

    If possible (not dependant on form variables) move the display method to the table and remove from the form.

    A workaround will be to use a map to store the result and only recompute when needed not found in map. You can see an example in the Pastebin in this answer.