CALCFIELDS Function (Record)

Updates the FlowFields in a record.

[Ok :=] Record.CALCFIELDS(Field1, [Field2],...)


Field1, Field2, …

Type: Field

The FlowFields that you want to update. Each field must be defined as a FlowField and must belong to the same record variable.

FlowFields are virtual fields. The values in these fields are not saved in the table. This means that you must use the CALCFIELDS function to update them. For example, if you retrieve a record using the FIND Function (Record) and NEXT Function (Record), the FlowFields in those records are set to zero (0). Then, when you call CALCFIELDS, their values are updated.

When a FlowField is a direct source expression of a control on a form or a report, the calculation will be performed automatically.

You can also use the CALCFIELDS function to calculate binary large objects (BLOBs). For more information, see BLOB Data Type.

This example shows how to use the CALCFIELDS function to find the balance on December 31, 2008 and the net change for a customer in 2008.

This example requires that you create the following variable.

Variable name DataType Subtype




CustomerRec.SETRANGE("Date Filter",010108D,123108D);
CustomerRec.CALCFIELDS(Balance, "Net Change");

The first line sets up a filter for the date filter field in the customer record. This field is a FlowFilters field which is used to calculate some of the FlowFields in the customer record. In the second line, the FlowFields are calculated.