In AEM, you can use Form Calc to sum the total of amount fields without having to have an array or selecting each field object. While there are several methods, the following has been tested in AEM 6.5 and the latest commercial version of Adobe Acrobat.
Sum By Node Method
Sample Syntax: $ = sum(Table1.Row[*].CurrentBal);
Where "Row" is the name of every Row in the table and "CurrentBal" is the name of every field in the column to be totaled.
Key Step: Row and Field Naming Convention
The first key to this method is to rename the Table rows from the default. When you create a Table using the Insert, Table commands, the AEM system automatically names each Row with the word, "Row" plus a Number, 1, 2, 3... What the formula states, though, is that each Row in Table1 is called only, "Row".
Note: as you rename the rows, AEM will adding numbering, beginning with zero and incrementing by one, placing the numbers in brackets. Example: Row[0]; Row[1]; Row[2]. This action does not cause any problems with the formula and does not cause any Accessibility problems.
The second key to this method is to ensure each field in the column to be totaled is named, "CurrentBal" in the hierarchy. This naming convention does not interfere with providing unique Custom Screen Reader text for each field in this column. Each field is still perceived by the AEM system, Adobe Acrobat, and Screen Reader Software as unique objects.
Resources
Acrobat forum: FormCalc Sum in a Table - LiveCycle 8.0, User, MarionSchweda
Experience League Communities - JavaScript/FormCalc Calculating Total Sum, User whyisthisme
Comments