Expand my Community achievements bar.

SOLVED

Sum of Values from previous rows in a dynamic table

Avatar

Former Community Member

Hello,

I have a dynamic table has multiple rows (added dynamically via a button).  One column in the table is a Quantity column.  Another is a Total column.  We do not want to keep a running total, but only wish to display a total when the rest of the cells in that row are emty and the previous row(s) has/have values in the Quantity column.  The Total is the sum on the Quatnities up to a blank row.  Below is a sample.  How do I get teh value of the Quantities in the previous rows?

QuantityTotal


5
8
12

25


7
27

34


22

22


Another option might be to put the Total in the last row with data as opposed to the row below the data.

Any ideas?

Regards,

Karl

1 Accepted Solution

Avatar

Correct answer by
Level 10

The script is written to achive your requirement (i.e. the second approach you have mentioned)

.

You can either contact me at nith.igate@gmail.com to get the sample form created.

Or the following is the XML Source of the form. Copy the entire content in XML source view of your form and see the result.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

The script is written to achive your requirement (i.e. the second approach you have mentioned)

.

You can either contact me at nith.igate@gmail.com to get the sample form created.

Or the following is the XML Source of the form. Copy the entire content in XML source view of your form and see the result.

Avatar

Former Community Member

Thank you.

I was able to take your script and modify it for my needs, and make the first scenario work.  There are a few tricky "if" statements for when a line is deleted from the table to keep the Total column clean, but it works nicely.  I appreciate the sample to get me where I needed.

Note to future readers that I have to edit the XML source to remove a bunch of line breaks.  The Add Line didn't work as a result, but I set a minimum number of rows to 20 and was able to play around all I needed.

Regards,

Karl