# FieldRef.CalcField() Method
> Version: _Available or changed with runtime version 1.0._
Updates FlowFields in a record.
## Syntax
```al
[Ok := ]  FieldRef.CalcField()
```
## Parameters
FieldRef
Type: fieldref-data-type
An instance of the fieldref-data-type data type.
## Return Value
*[Optional] Ok*
Type: ../boolean/boolean-data-type
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
## Remarks
FlowFields are virtual fields. The values in these fields are not saved in the table. This means that you must use the CalcFields method to update them. For example, if you retrieve a record using the ../recordref/recordref-find-method and ../recordref/recordref-next-method methods, the FlowFields in those records are set to zero \(0\). Then, you can call FieldRef.CalcField, to calculate the value in one of the FlowFields.
When a FlowField is a direct source expression of a control on a page or a report, the calculation is automatically performed. You can also use the CALCFieldS method to calculate binary large objects \(BLOBs\). See BLOB Data Type<../library>.
This method is similar to the ../record/record-calcfields-method method.
## Example
The following example opens table 18 \(Customer\) as a RecordRef variable that is named CustRecordref. The ../recordref/recordref-find-method selects the first record in the table and then loops through all the records until no records could be found. For each record, the ../recordref/recordref-field-method creates a FieldRef variable that is named MyFieldref for the Balance Due field \(field 66\), which is a flow field. The CalcField method is called to update the field before the customer ID and the balance due are displayed. Otherwise, the balance due for every record will be set to 0.
```al
var
    CustRecordref: RecordRef;
    MyFieldRef: FieldRef;
    Count: Integer;
    Text000: Label '%1: \\Balance Due: %2.';
begin
    Count := 0;
    CustRecordref.Open(18);
    if CustRecordref.Find('-') then
      repeat
        MyFieldRef := CustRecordref.Field(66);
        MyFieldRef.CalcField;
        Message(Text000, CustRecordref.RecordId, MyFieldRef);
        Count := Count + 1;
      until CustRecordref.Next = 0;
end;
```
## Related information
fieldref-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>
../../../administration/optimize-sql-al-database-methods-and-performance-on-server

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/fieldref/fieldref-calcfield-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-calcfield-method/
