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;
}

  

posted @ 2020-12-08 15:29  szlailai  阅读(156)  评论(0编辑  收藏  举报