{"title":"Record.CalcFields(Any [, Any,...]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-calcfields-method/","by":"JOP-AL","license":"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/record/record-calcfields-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.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-calcfields-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Calculates the FlowFields in a record.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Record.CalcFields(Any [, Any,...]) Method","slug":"recordcalcfieldsany-any-method","at":0,"chars":2981},{"level":2,"title":"Syntax","slug":"syntax","at":202,"chars":81},{"level":2,"title":"Parameters","slug":"parameters","at":283,"chars":172},{"level":2,"title":"Return Value","slug":"return-value","at":455,"chars":238},{"level":2,"title":"Remarks","slug":"remarks","at":693,"chars":1501},{"level":2,"title":"Example","slug":"example","at":2194,"chars":570},{"level":2,"title":"Related information","slug":"related-information","at":2764,"chars":217}],"text":"# Record.CalcFields(Any [, Any,...]) Method\n> Version: _Available or changed with runtime version 1.0._\nCalculates the FlowFields in a record. You specify which fields to calculate by using parameters.\n## Syntax\n```al\n[Ok := ]  Record.CalcFields(Field1: Any [, Field2: Any,...])\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\nField1\nType: ../any/any-data-type\n*[Optional] Field2*\nType: ../any/any-data-type\n## Return Value\n*[Optional] Ok*\nType: ../boolean/boolean-data-type\ntrue 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.\n## Remarks\nFlowFields are virtual fields. The values in these fields are not saved in the table. This means that you must use either the CalcFields method or the record-setautocalcfields-method to update them. For example, if you retrieve a record using the record-find-method and record-next-method, the FlowFields in those records are set to zero \\(0\\). Then, when you call CalcFields, their values are updated.\nWhen a FlowField is a direct source expression on a page or a report, the calculation is performed automatically.\nYou can also use the CalcFields method to retrieve binary large objects \\(BLOBs\\). See ../blob/blob-data-type.\nDynamics 365 Business Central automatically maintains a count for all SIFT indexes. Therefore, SumIndexField Technology (SIFT) is used by default when the calculation method for a FlowField is Count or Average.\nYou can prevent the SIFT indexes from being updated by setting the ../../properties/devenv-maintainsiftindex-property of the index in the base table to False. Then Business Central will traverse all records in the base table to perform the calculation instead of using SIFT. This can reduce the number of required SIFT indexes, which can improve performance. See ../../devenv-sift-performance.\nIn Dynamics 365 Business Central, an index is not required to support a certain sorting, but sorting without an index could lead to bad performance if a search returns a large result set, which would then have to be sorted before the first row is returned.\n## Example\nThis example shows how to use the CalcFields method to find the balance on December 31, 2008 and the net change for a customer in 2008.\n```al\nvar\n    CustomerRec: Record Customer;\nbegin\n    CustomerRec.SetRange(\"Date Filter\",20080101D,20081231D);\n    CustomerRec.CalcFields(Balance, \"Net Change\");\nend;\n```\nThe first line sets up a filter for the Date Filter field in the Customer record. This field is a FlowFilter field which is used in the filter definition for several FlowFields in the Customer record. In the second line, the FlowFields are calculated.\n## Related information\nrecord-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>\n../../../administration/optimize-sql-al-database-methods-and-performance-on-server"}