Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

calculate rows in adjacent tables

Avatar

Level 3

Hello all,

I have 2 tables, one is above the other on the page.   They are named "majtable" and "eductable", all the rows in both tables are named "row" and all the cells for the colums to add are all named "mhours".

Here's my formula in formcalc (calculation event)

 

sum(majtable.row[*].mhours[*] + eductable.row[*].mhours[*])

It's is saved as dynamic and the preview is dynamic/interactive.

It won't add the mhours cells for both tables together.  I can get one table to calculate or the other, but not both.  Should I rename the column cells in one table something other than "mhours" (I thought not since the tables are named differently).

I have lots and lots of tables which add just fine, across pages and having multiple tables.  But this one won't work.  I have done it wrong or maybe there is a bug/the file is corrupt.

Thanks for any help!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The sum() function has parameters comma separated. So, this should work:

$ = sum(majtable.row[*].mhours, eductable.row[*].mhours)

In addition you only need to use the wild card for the repeating row.

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

The sum() function has parameters comma separated. So, this should work:

$ = sum(majtable.row[*].mhours, eductable.row[*].mhours)

In addition you only need to use the wild card for the repeating row.

Hope that helps,

Niall

Avatar

Level 3

That did it!  Thank so much  (ahhh, I still have to much to learn)!

Happy Friday