Thursday, 16 October 2014

Use View in X++ to get value based on one of its field

Hi,
Below is the sample code used to get value in field(unbound) which is created at VIEW level based on other fields. 
Requirement is, in VIEW we need to have Remain field(which is not in DS table) value based on AmountMSt and SettlesAmountMST fields. 
Create new REAL field at VIEW field level and link this method in “ViewMethod” properties of that field. when you open the view the data will come automatically based on below logic. 
Public Server Static str Remain()
{
DictView dv = new DictView(tableNum(IntCustTransView));
str amount = dv.computedColumnString(identifierStr(custTrans),
fieldStr(CustTrans, AmountMST));
str settleAmt = dv.computedColumnString(identifierStr(custTrans),
fieldStr(CustTrans, SettleAmountMST));
return SysComputedColumn::subtract(amount,settleAmt);
}

No comments:

Post a Comment