AX 2012 cache display method 的两种方法

1. 旧方法

Method:
display LogisticsAddressName dspDlvAddrName()
{
    LogisticsAddressName    dlvName;
    LogisticsPostalAddress  dlvAddress;
    LogisticsLocation       dlvLocation;

    dlvAddress  = LogisticsPostalAddress::findRecId(this.DeliveryPostalAddress);
    dlvLocation = LogisticsLocation::find(dlvAddress.Location);
    dlvName     = dlvLocation.Description;

    return dlvName;
}

 在 FormDataSource 的 init() 的super(); 之后加

cacheAddMethod 申请
void init()
{
    super();
    this.cacheAddMethod(tableMethodStr(WMSOrder, dspDlvAddrName));
}

  

2. 新方法,利用 方法体上面的attribute 即可,不需要再在form的datasource的init事件中声明

[SysClientCacheDataMethodAttribute(true)]
display LogisticsAddressName dspDlvAddrName()
{
    LogisticsAddressName    dlvName;
    LogisticsPostalAddress  dlvAddress;
    LogisticsLocation       dlvLocation;

    dlvAddress  = LogisticsPostalAddress::findRecId(this.DeliveryPostalAddress);
    dlvLocation = LogisticsLocation::find(dlvAddress.Location);
    dlvName     = dlvLocation.Description;

    return dlvName;
}

  

原文地址:https://www.cnblogs.com/sxypeace/p/14102901.html