Hi,
In this post will provide the code to view the usage of count method of class SysComputedColumn in D365FO.
Step 1: Created a simple view (say)DAXCustomerTransCount with CustTable and CustTrans.
Step 2: Selected field AccountNum of datasource CustTable and field TransType of datasource CustTrans under GroupBy node respectively.
Step 3: Created a view method by name computedTransCountStr to show the count of transactions for every customer based on transaction type.
public class DAXCustomerTransCount extends common
{
private static str computedTransCountStr()
{
TableName viewName = tableStr(DAXCustomerTransCount); //Entity name
str accountNumCount = SysComputedColumn::returnField(viewName, identifierStr(CustTrans), identifierStr(RecId));
return SysComputedColumn::count(accountNumCount);
}
}
Step 4: Created the following on the view:
- Mapped field AccountNum from CustTable
- Mapped field TansType from CustTrans.
- Unmapped field TransCount(namely) and selected the method computedTransCountStr
Step 5: Build the solution and using table browser of D365FO viewed the data returned by view DAXCustomerTransCount.
Regards,
Chaitanya Golla

Like
Report
*This post is locked for comments