Use of CALCFIELDS function in Business Central:
(1) In this article, we will get to know the use of the CALCFIELDS function in AL programming in D365 BC. It is used for calculating the value of FLOWFIELDS. FlowFields are virtual fields. The values in these fields are not saved in the table. This means that you must use either the CALCFIELDS function or the SETAUTOCALCFIELDS function.
|[Ok :=] Record.CALCFIELDS(Field1, [Field2],…)|
(3) Use of CALCFIELDS as:
- It is used for calculating values of FlowFields.
- It is used to retrieve binary large objects (BLOB).
(4) CALCFIELDS function uses SumIndexField Technology (SIFT).
(5) Let’s take an example.
- Calcfields for FlowFields: For calculating FlowFields follow the below image. Suppose we want to calculate and display the Item Inventory. Note: But sure that field nature should be FlowField, otherwise system shows an error while running the object. You can also use in Repeat until function for retrieving records from flowfields.
- Calcfields for Blob: For calculating the Blob field follow the below image. Suppose we want to show or display an image.
- Calculating As On Inventory:
- Calculating Locationwise On Inventory:
- Calculating Date Range On Inventory:
- Calculating Multiple Flow Fields: