2 Replies Latest reply on Feb 10, 2012 1:05 PM by johnAdonaldson1

    Totaling subTotal fields

    johnAdonaldson1

      In my PDF I have areas where I am doing a Grand Total field. It is totalling two filled fields and a field that is a Total of two other fields. Such as

       

       

      Grand Total ( 1+2+3)

       

      1.  Item1                   - Filled In variable

       

      2.  Item2  (Total)      - Total of Sub Item 1 & 2

             Sub Item1       - Filled in variable

             Sub Item 2       - Filled in variable

       

      3.  Item3                   - Filled in variable

       

       

      Item 2 Total is correct

      Grand Total is not correct.

       

       

      // Custom Calculate script for text field
      (function () {

          // Get the field values
          var v1 = getField("Item1").value;
          var v2 = getField("Item2").value;
          var v3 = getField("Item3").value;

          // Set this field value
          event.value = ( 1 * v1) + ( 1 * v2) + ( 1 * v3);

      })();

        • 1. Re: Totaling subTotal fields
          gkaiseril MVP & Adobe Community Professional

          Have you checked the calculation order of the fields?

           

          ''Edit fiields => Set Field Calculation Order"

           

          Order the fields in the order to calculate from the first at the top and the last at the bottom.

          1 person found this helpful
          • 2. Re: Totaling subTotal fields
            johnAdonaldson1 Level 1

            I fixed the problem by doing the following

             

            // Custom Calculate script for text field
            (function () {

                // Get the field values
                var v1 = getField("Item1").value;
              

                var v4 = getField("Item2a").value; 

                var v5 = getField("Item2b").value;

             

                var v3 = getField("Item3").value;

                   // Set this field value
                event.value = ( 1 * v1) + ( 1 * v4) + ( 1 * v5) + ( 1 * v3);

            })();