Axapta may call display methods over and over when navigating in table. If there are a lot of display methods it would be a trouble. cacheAddMethod provides save display methods at server and gives good performance increase. This method can be call after datasource's init method. If called from at wrong place it would be a reason of frozen of Axapta. Also this type display methods should be "table" methods.
This technique also works for edit methods.
public void init()
{
super();
this.cacheAddMethod(tableMethodStr(B_CallTrack, CustomerName));
this.cacheAddMethod(tableMethodStr(B_CallTrack, EndUserWarrantyStart));
this.cacheAddMethod(tableMethodStr(B_CallTrack, ExtendedWarrantyDate));
this.cacheAddMethod(tableMethodStr(B_CallTrack, ModelGroupID));
}
Cached display/edit methods don't update before update methods run. When necessary refresh display methods before update, you may use cacheCalculateMethod:
B_CallTrack_DS.cacheCalculateMethod(tableMethodStr(B_CallTrack, EndUserWarrantyStart));
Update for AX 2012:
This process eaiser with AX 2012. You can use SysClientCacheDataMethodAttribute. There's an optiona parameter too. If you send true for this parameter update issue at upper solved with automatically. But with this way display/edit method will be cached in all forms. If you don't want this old way sill valid.
[SysClientCacheDataMethodAttribute(true)]
display name dispCustName()
{
return CustTable::find(this.CustAccount).Name;
}
Hiç yorum yok:
Yorum Gönder