2 Replies Latest reply on Sep 21, 2009 11:08 AM by Eroopaig

    Help! Grand Total Script Errors!




      I've taught myself to create 33 PDF forms in Adobe Acrobat 8.2 LiveCycle Designer for my company. I can add simple totals across a table, but I'm having problems with the Grand Total field. In Excel I could complete this function in less than one minute, but for some reason I've been sent on a wild goosechase to calculate a simple Grand Total in Designer. I have almost no knowledge of FormCalc or fJavaScripting - the only scripting I know is from my experience with Excel.


      This is what I've done (copy of form table attached):


      Binding Names:

      Qty                  Unit Price               Total Price               Calculation

      ------------------------------------------------------------------------------------------ --------------

      quantityA          unitpriceA               totalpriceA               quantityA+unitpriceA (this works)                   

      quantityB          unitpriceB               totalpriceB               quantityB+unitpriceB (this works)

      quantityC          unitpriceC               totalpriceC               quantityC+unitpriceC (this works)

      quantityD          unitpriceD               totalpriceD               quantityD+unitpriceD (this works)


                                     Grand Total Calculation:                  sum(totalpriceA+totalpriceB+totalpriceC+totalpriceD)


      Error I receive: 


      Script failed (language is formcalc; context is xfa[0].form[0].form1[0].#subform[0].Table7[0].Row5[1].grandTotal[0]) script=sum(totalpriceA+totalpriceB+totalpriceC+totalpriceD)

      Error: accessor ‘totalpriceA’ is unknown.


      I've also tried copy & pasting this into the script editor, but it didn't work either:


           <script contentType="application/x-javascript">this.rawValue = firstfield.rawValue + secondfield.rawValue;</script>



      Help, this is all I need to do to complete this job!  Thanks so much for your help!



        • 1. Re: Help! Grand Total Script Errors!
          pguerett Level 6

          The issue is that the GrandTotal field that you are calculating is not in the same context as the other fields so you must "path" your way to them. See my attached updated sample. A good way to make sure that this does not happen again is to place the cursor in the script editor where you want the object reference to appear. Now hold down the ctrl key and point to the field that you want to reference. The mouse pointer will change to a V. Now click the mouse and the proper field reference will appear where your cursor was.



          • 2. Re: Help! Grand Total Script Errors!
            Eroopaig Level 1

            Thanks Paul!

            Being self-taught, I somehow missed the part about directing the path.

            This worked perfectly on several different tables.

            I can't thank you enough!