2 Replies Latest reply on Jun 22, 2011 7:00 AM by ksmudde

    How do you total a column of rows that are not repeating and may get deleted?



      I am new to livecycle and javascript.  I have managed to create a form with 9 rows.  Each row has a button to add a new instance of the row and to delete the current instance.  Each row has numeric field titled "Amount".  Because my rows have different names, the "Amount" in each row is not binded therefore the calculation below will not work:




      Instead I am using the more specific sum formula below:


      sum(Table1.Product1[*].Amount[*], Table1.Product2[*].Amount[*], Table1.Product3[*].Amount, Table1.Product4[*].Amount, Table1.Product5[*].Amount,  Table1.Product6[*].Amount, Table1.Product7[*].Amount, Table1.Product8[*].Amount, Table1.Product9[*].Amount);


      My issue is that once a row is deleted from my form, the sum no longer works because it is looking for that deleted row.


      Does anyone know a better way to do this?  Is there a simpler format for my sum calculation or is there a way to have it check to see if the row exists and if it does not exist  just set it's value to 0 so the calculation still works?


      Thank you in advance!