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

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
Adobe Summit 2023 | Complete list of AEM Sessions & Labs

FormCalc

Avatar

Level 4

I have a complex table which has Totals going across the 12 monthly columns (eg July - Jun) and also has Total going down the rows (eg Total Income).

The formula that I have used for adding the the amounts across the colums is sum(Table20.Row2.Cell[*])  I have renamed majority of the cells to just 'Cell'.  This works perfectly!  My rows are number 1 - 43.

I now have an issue with the formula for adding the amounts going down each row.  I used

sum(Table20

.Row2.Cell,Row3.Cell,Row4.Cell,Row5.Cell,Row6.Cell,Row8.Cell,Row9.Cell,Row10.Cell,Row11.Cell,Row12.Cell,Row13.Cell) in the first cell and it worked perfectly but when I copied across to the other row cells, they all put the same amount in. 

I understand why this has happened, all the cells and named 'Cell' but I don't know if there is an easier way.

Assistance would be greatly appeciated.

Jen

2 Replies

Avatar

Level 10

I have attached a calculation table sample that demonstrates my generic approach. The PDF looks like this...

generic_table_view.PNG

I create 1 body row named 'row' with 13 columns. I then change the columns from text objects to numeric field objects and rename the objects 'jan', 'feb', 'mar',...and 'total'. I then declare any other properties I want to apply such as paragraph alignment. Once I am satisfied the 1 row satisfies my requirememts I then use the Copy Multiple toolbar feature to replicate as many rows as I need.

I then apply the same approach to the footer row. Each cell in the footer row becomes a column total. For each column total it easy to apply a FormCalc to each month. For example,

// form1.page1.subform1.table.footer.jan_::calculate - (FormCalc, client)

$ = Sum(table.row[*].jan)

For the row totals you need simply to add the column variables. FormCalc is smart enough to limit the scope to the current row.

// form1.page1.subform1.table.row[0].total::calculate - (FormCalc, client)

$ = jan + feb + mar + apr + may + jun + jul + aug + sep + oct + nov + dec

Steve

Avatar

Level 4

Thanks Steve.  Can you please e-mail me the attachment.  bluey72@live.com