Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

I have a dynamic table that calculates the sum of all rows, no issue. I'm struggling with pulling out a subtotal though. I would like to have a check box in each row that flags those rows and gives the sum of their total. Any help would be greatly app

Avatar

Former Community Member

I have a dynamic table that calculates the sum of all rows, no issue.  I'm struggling with pulling out a subtotal though.  I would like to have a check box in each row  that flags those rows and gives the sum of their total.  Any help would be greatly appreciated.

1 Reply

Avatar

Level 7

762680_pastedImage_0.png

Here's something I threw together rq. The script is in the change event for the checkbox in the table. (Of course, you'll have to modify it to suit the names of your fields.)


var rows = xfa.resolveNodes("tblAmounts.Row1[*]");


var subtotal=0;


for (i=0; i<rows.length; i++) if (rows.item(i).cbAdd.rawValue == 1) subtotal = subtotal + rows.item(i).nfAmount.rawValue;


nfSubtotal.rawVlaue=subtotal;