Quantcast
Channel: Adobe Community: Message List - PDF Forms
Viewing all articles
Browse latest Browse all 57214

Re: Help with Running Totals

$
0
0

No, each accumulation field needs to only run the calculation when the associated inspection field is not empty. You can only use the custom calculation script for this type of control.

 

// determine column index from field name;

var nCol = event.target.name.substr(10); // extract from position 10 on to right;

event.value = ""; // clear result;

// see if current inspection in not empty;

if(this.getField("Spacing" + nCol).valueAsString !="") {

// compute accumulated value from column 1 to current column;

var sum = 0; // accumulated value;

// for index from 0 to less then column number loop and index by 1;

for(i = 0; i < nCol; i++) {

sum = sum + Number(this.getField("Spacing" + (i + 1)).value);

} // end field loop;

event.value = sum; // set field value;

} // end inspection field not null string;

 

Using hierarchical field names would make the script simplr.


Viewing all articles
Browse latest Browse all 57214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>