SetFormFieldSimpleCalculation
Form fields, actions
Description
Adds an AFSimple_Calculate action for sum, average, product, minimum or maximum aggregation
Syntax
Function TPDFlib.SetFormFieldSimpleCalculation(Index: Integer; Operation: TPDFlibFormCalculationOperation; Const SourceFieldIndices: Array Of Integer): Integer;Parameters
| Index | One-based index of the target field that receives the calculation action and joins the calculation order |
|---|---|
| Operation | fcoSum 0, fcoAverage 1, fcoProduct 2, fcoMinimum 3 or fcoMaximum 4 |
| SourceFieldIndices | Non-empty array of one-based source-field indices; duplicates, the target field itself, zero or negative entries and fields without a title are rejected, and every title is escaped into the generated script |
Return values
| 1 | The AFSimple_Calculate action was added and the target field was appended to the AcroForm calculation order |
|---|---|
| 0 | The operation is outside the enumeration, the source list is empty, duplicated, self-referential or invalid, the field index is invalid, or the action or calculation order cannot be stored |
Remarks
Source indices are resolved to field names and safely escaped before script generation
Empty, duplicate, invalid and self-referential source lists are rejected, whilst successful calls add the target field to the AcroForm calculation-order array