Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Total of Field in dynamic Sub Form with certain condition


Level 2

Hi Experts,

Sorry for beginner question.

I have dynamic sub form (add/remove button) with 1 drop down field and 1 decimal field.

User can add/remove the subform dynamically.

Now i want to summarize the decimal field only if the drop down field = "A".

1. How to get the no of the final subform(s) ?

2. How to summarize the decimal field based on certain condition ?


0 Replies


Level 10


This does involve a couple of methods, but is achievable. Have a look at example 10 in this form as a demo:

The JavaScript in the click event would look something like this:

// set up a variable

var vTotal = 0;

// resolve the row objects in the table

var nRows = xfa.resolveNodes("Table1.Row1[*]");

// set up a loop to go through the repeating rows

for (var i=0; i<nRows.length; i++)


     if (nRows.item(i).CheckBox.rawValue == "A")


          vTotal += nRows.item(i).DecimalField.rawValue;



// set total field

this.rawValue = vTotal;

Note that you will have to change the object references Table1, Row1, Checkboc and DecimalField to suit your object names.

Hope that helps,