Add computed columns to a view In Dynamic Ax 2012 R3
This walkthrough describes how you can add a computed column to a view in Microsoft Dynamics AX R3.
A computed column is the output of a computation that inputs a regular column. For example, suppose your table has a column that is named AnnualRent. Your view could return a computed column that is named MonthlyRent and which calculates AnnualRent/12.
There are a few very good blogs online already showing examples of using computed columns with Sum() and other aggregate functions, but the intention here is to explore the possibility of having a computed column that is in itself a Select statement
private static server str Comp_AmountMST()
{
return strFmt("select sum(AmontMST) from VENDTRANS where VendTrans.ACCOUNTNUM = " +
SysComputedColumn::returnField(
tableStr(Basit_VendTransView),
identifierStr(VendTrans),
fieldStr(VendTrans,AccountNum)));
}