Use of CALCFIELDS function in Business Central

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.

(2) Syntax:

[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 function for inventory in d365 bc
  • Calcfields for Blob: For calculating the Blob field follow the below image. Suppose we want to show or display an image.
Calcfields for Blob in Bunsiness Central

(6) For using this syntax, you must know about the “FlowFields” & “FlowFilters”. Patterns and use of Calcfields function in D365 BC, as shown.

  • Calculating As On Inventory:
Calculating As On Inventory- Calcfields
  • Calculating Locationwise On Inventory:
Calculating Locationwise On Inventory- Calcfields
  • Calculating Date Range On Inventory:
Calculating Date Range On Inventory- Calcfields
  • Calculating Multiple Flow Fields:
Calculating Multiple Flow Fields- Calcfields

How to Modify Sign-in Method in BC D365 SAAS or Online Version
How to Disable Multi-Factor Authentication in D365 BC Online
How to create Bank Account Master in Business Central
Auto Vendor Payment Creation from Vendor Ledger Entries in D365 BC
Record.CalcFields(Any [, Any,…]) Method– Microsoft Docs

Leave a Reply