I have a query named CPTransQuery with structure like a picture below
From that query, I create a view named CPTransView with structure like a picture below
Let's see 2 field with name CalculatedReal and ItemName is a calculated field
How to make it ?
At first, create a method with named getCalculated() with detail code like below
public static server str getCalculated()
{
return SysComputedColumn::multiply(
SysComputedColumn::divide(
SysComputedColumn::returnField(tableStr(CPTransView),{
return SysComputedColumn::multiply(
SysComputedColumn::divide(
identifierStr(CustPackingSlipTrans),
fieldStr(CustPackingSlipTrans,Qty)),
SysComputedColumn::returnField(tableStr(CPTransView),
SysComputedColumn::returnField(tableStr(CPTransView),
identifierStr(InventTrans),
fieldStr(InventTrans,Qty)) ),
SysComputedColumn::returnField(tableStr(CPTransView),
SysComputedColumn::returnField(tableStr(CPTransView),
identifierStr(CustPackingSlipTrans),
fieldStr(CustPackingSlipTrans,ValueMST)) )
;
}
;
}
that methode calculated :
(CustPackingSlipTrans.Qty / InventTrans.Qty * CustPackingSlipTrans.ValueMST
After it, right click on node Fields on CPTransView and then select New->Real Computed Column
Set properties of new field like a picture before. If you have finished all step, let's try to open view :
thank you..