Expand my Community achievements bar.

## Trying to calculate sum of column values in an add/delete a row table  Level 1

I am very new to live cycle and am learning as I go, basically web searching for help and trial and error (lots!).  I am trying to figure out what code to use in each of the 8 columns of a table I have in order to sum each columns' user entered value.  The table has a header row, and then row 1 has subform with a "+" and a "-" button to add and remove the row.  The tabel functions for adding a row and removing a row (even a specific row) are working fine.   I do not need to sum each row.  I need to calculate a sum at the bottom of 8 of the columns, and they are all numeric field objects.  From what I can find, I need to add a Row2 to the table that will be my totals row, but I don't know what to do with each cell for that row for the 8 columns I need to individually calculate the totals for.

Any help is greatly appreciated!

6 Replies  Level 10

You can use the asterisk accessor to address multiple instances of a repeatable object, such as a table row.

Given your row contains a field named "total", you can add a footer row with a calculation script to summarize the values the "total" field in all instances of the row.

\$ = Sum(row[*].total)  Level 1
I must not be doing something right because I keep getting an error.  Level 10

Make sure you've selected FormCalc not JavaScript as scripting language.   Level 1

I did that, but I still have something wrong. This is the error I get: This is my hierarchy: Then I thought maybe you meant to I need to use the cell name that I am trying to total the values of in place of the word "total" in your script.  So I tried using the name of the column cell I am trying to total the values for which for the first column is 'BottlesOutU'.  This is what I tried:   \$=Sum(row[*].BottlesOutU)   and this, \$=Sum(BottlesOutU[*].total)       I still get an error saying the accessor is unknown: I added a row (named SampleTotals) after Row1 and any added row the end user makes.  I need that row to show the calculated total value for each of the columns that have a numeric field.  I am very new to LC and am really learning as I go- it is probably something easy I am missing.  This is my table: Thanks for any insight you can provide!  Level 10

Ok, your repatable row is named "Row1". To calculate the summary of all instances of the field "BottlesOutU" the FormCalc script is as follows.

``\$ = Sum(Row1[*].BottlesOutU)``  Level 1
Thank you so much! 