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;
}
24 Haziran 2013 Pazartesi
AXAPTA - Display method authorization check
//BP Deviation documented
display CustName customerName()
{
CustName custName = '';
DictTable dictTable = new DictTable(tablenum(CustTable));
;
if (dictTable.rights() >= AccessType::View)
{
custName = CustTable::find(this.CustAccount).Name;
}
return custName;
}
display CustName customerName()
{
CustName custName = '';
DictTable dictTable = new DictTable(tablenum(CustTable));
;
if (dictTable.rights() >= AccessType::View)
{
custName = CustTable::find(this.CustAccount).Name;
}
return custName;
}
Etiketler:
authorization check,
AX,
AXAPTA,
display,
method
6 Haziran 2013 Perşembe
AXAPTA - Begin and end of the day
info( strfmt("%1 --- %2", datetobeginUtcDateTime( today() , DateTimeUtil::getUserPreferredTimeZone() ) ,
datetoendUtcDateTime( today(), DateTimeUtil::getUserPreferredTimeZone() )));
datetoendUtcDateTime( today(), DateTimeUtil::getUserPreferredTimeZone() )));
Kaydol:
Kayıtlar (Atom)