RecalculateFormFields

Forms, calculation, performance

Description

Builds the form calculation dependency graph, rejects cycles before changing values, and executes calculation actions in dependency order with the AcroForm calculation order used as the stable priority among ready fields

Syntax

Function TPDFlib.RecalculateFormFields(ChangedFieldIndex: Integer= 0): Integer;

Parameters

ChangedFieldIndexZero recalculates every field with a calculation action; a positive field index recalculates only reachable successor fields

Return values

Returns the number of calculation actions executed

A dependency cycle returns 0, sets LastErrorCode to 707 and leaves all field values unchanged

Remarks

All results are evaluated in a private value snapshot and committed only after every selected action succeeds, preventing a late unsupported action from leaving partial calculations

Each committed calculated successor joins the current-session appearance dirty set, so RegenerateDirtyFormAppearances refreshes the complete affected calculation closure without scanning unrelated fields

See also

ExecuteFormFieldScript, GetFormCalculationGraphJSON, RegenerateDirtyFormAppearances