These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Need to calc a total by adding values of columns within a given row

klwalsh611
Registered: Sep 10 2009
Posts: 28

i have a form that has multiple rows for products and multiple columns within each row for sizes. the value to be entered in each size column is to be calculated as a total qty of sizes that then need to be multiplied by a unit price. the number columns for sizes varies anywhere from one column per row to as many as ten columns per row. how can script the total qty of all sizes in a given row?

Ex. SizeCol1_Row.1, SizeCol2_Row.1, SizeCol3_Row.1, etc. all in Row1.

I understand how to capture the row by using the "var cRow = event.target.name.split(".").pop()"
but how do I capture the Column sequence for looping through all the Size Cols until I have reached the end for the given row and then totalling them?

thanks!

My Product Information:
Acrobat Pro 9.3.1, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
So you have
SizeCol1_Row.1
SizeCol2_Row.1
SizeCol3_Row.1
...
SizeColx_Row.1
But x changes from row to row, correct?

You can place a this.getField("SizeCol"+i+"_Row.1") command in a loop (with i being the iterator, of course). When getField gives back null (because the field you were looking for doesn't exist), you exit the loop (break) and use the information you gathered so far to set the total field's value.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com