Hey there,
I try to get only the result of different methods into a view, that SQL can read. I read about calculated columns and it should do the trick, but I don't exactly know how.
I see that the SysComputedColumn has a lot of possibilities to engineer the calculations yourself, however, we have many calculations added to different tables, and I rather not want to reverse-engineer them.
For example, if I take one of the tables (self-created, so not standard AX) I want to create a view from we have the following method getNetAmount:
display PMENetAmount getNetAmount(PMGCurrDate _curDate = systemDateGet())
{
PMCContractPricesCalcTotals contractPricesCalcTotals;
;
contractPricesCalcTotals = PMCContractPricesCalcTotals::construct();
contractPricesCalcTotals.parmContractId(this.ContractId);
contractPricesCalcTotals.parmReferenceDay(_curDate);
contractPricesCalcTotals.calcContractPriceTotals();
return contractPricesCalcTotals.getNetAmountExclTax();
}
It doesn't even show the calculation yet, but is there a way to show what this function returns, into a string in a computed column? Instead of re-creating the entire method?
Thanks in advance,
Igor
*This post is locked for comments
I have the same question (0)Hi idspmax,
Simple answer is "No". Computed column should return select statement that then will be used to build SQL view. SysComputedColumn is a helper class that helps you to build a string with SQL statements.
PMCContractPricesCalcTotals could have complex logic behind to do multiple selects and calculations. Computed column statement is a simple sub select, something like "SELECT AccountNum From CustTable", so you should be able to do all the calculation using SQL.
Syed Haris Shah
9
Mea_
4
Community Member
2