4 Replies Latest reply on Dec 16, 2010 6:44 AM by gkaiseril

    To Script Form Fields to Calculate across several PDFs in a Portfolio?


      How can I custom script a PDF's form field to add up the values in the same field found in several PDFs for all of the PDFs in a Portfolio?


      I'm new to JavaScript. I borrowed the following script and it works very well for addding up the total of the values for the fields in the PDF document. Now, how can I script a calculate field to sum total a field that is found in each of several PDFs within the same portfolio? If I can get this to work, then I will be able to create a PDF that can perform all sorts of calculations on the fields in all of the PDFs gathered up within a Portfolio of PDFs.


      Thanks in advance for your help!


      My code is a Page Action:




      /*********** belongs to: AcroForm:Accents_Capitals_Total:Calculate ***********/

      var SortFields = new Array("U00C1", "U00C0", "U00C2", "U00C4", "U00C9", "U00C8", "U00CA", "U00CB", "U00CD", "U00CC", "U00CE", "U00CF", "U00D3", "U00D2", "U00D4", "U00D6", "U00DA", "U00D9", "U00DB", "U00DC", "U00D1");
      function myAdditionFunction(SortFields)
      // n = number of fields that have a numerical value
      var n=0, sum = 0;
      for ( var i=0; i<SortFields.length; i++) {
      var v = this.getField(SortFields[i]).value;
      if ( v != "" ) {
      sum += v;
      if ( n == 0 ) event.value = "";
      else event.value = sum;