Hi,
In this post we will view the code to use comparison expression list on SysComputedColumn in D365FO.
Please refer to this post to know about the details of the view DAXCustVendExternalItem.
Step 1: Created a new field on the view DAXCustVendExternalItem by name ModuleType.
Step 2: Created a method "computeColumnModuleType" to display the value of field "Module type" as "Customer" if ModuleType enum is Cust (ModuleInventPurchSalesVendCustGroup::Cust) else display as "NotCustomer".
private static str computeColumnModuleType()
{
List moduleTypes = SysComputedColumn::comparisionExpressionList();
str moduleTypeField = SysComputedColumn::comparisonField(tableStr(DAXCustVendExternalItem),
tableStr(CustVendExternalItem), fieldStr(CustVendExternalItem, ModuleType));
moduleTypes.addEnd(SysComputedColumn::equalExpression(moduleTypeField,
SysComputedColumn::comparisonLiteral(ModuleInventPurchSalesVendCustGroup::Purch)));
moduleTypes.addEnd(SysComputedColumn::equalExpression(moduleTypeField,
SysComputedColumn::comparisonLiteral(ModuleInventPurchSalesVendCustGroup::Sales)));
moduleTypes.addEnd(SysComputedColumn::equalExpression(moduleTypeField,
SysComputedColumn::comparisonLiteral(ModuleInventPurchSalesVendCustGroup::CustGroup)));
return SysComputedColumn::if(SysComputedColumn::or(moduleTypes),
SysComputedColumn::returnLiteral("NotCustomer"),
SysComputedColumn::returnLiteral("Customer"));
}
Step 3: Assigned view method "computeColumnModuleType" to the field "ModuleType".
Step 4: Build the solution. In the table browser able to see ModuleType field values.
Output:
Regards,
Chaitanya Golla
*This post is locked for comments