X++ code using SysComputedColumn to use cast operation in D365FO
Hi,
In this post we can view the usage of cast operation using SysComputedColumn in D365FO.
Please refer to this post to know about the details of the view DAXPurchAgreementDetails.
( ) X code using SysComputedColumn with a SQL query in D365FO. - Dynamics 365 Finance Community
Step 1: Created a new field on the view DAXPurchAgreementDetails by name CreatedDate to display only the date part from date time.
Step 2: Created a method "computeCreatedDate" to display the date part from created date time of a purchase order.
public static str computeCreatedDate() { TableName viewName = tableStr(DAXPurchAgreementDetails); //Entity name str createdDateTimeStr = SysComputedColumn::returnField(viewName, identifierStr(PurchTable), fieldStr(PurchTable, CreatedDateTime)); return SysComputedColumn::cast(createdDateTimeStr, 'date'); }
Step 3: Assigned view method "computeCreatedDate" to the newly created field "CreatedDate".
Step 4: Build the solution. In the table browser able to see the created date of purchase orders.
Output:
Regards,
Chaitanya Golla
*This post is locked for comments