3 Replies Latest reply on Oct 19, 2009 6:03 AM by ashalles123

    Custom calculation in Acrobat 8


      I took on creating a form for a non-profit org...and I thought it would be a 5 min thing. But then I found out that it needs calculations.I know nothing about Javascript and I think that is what is needed for part of this form.


      It is a tracking sheet for packs to figure out how much each scout sold, but also adds up item quantities for all of the 13 different products at the bottom.


      There are 13 different item columns with different prices that need to add up into a "total sold" column.


      Plus each of those 13 different items need to total at the bottom for the total quantity sold within the whole pack.


      I get how to do the quantity of items sold within a column, that's easy. But how do I get it to calculate and multiply by the product price?


      I thought I could just copy and paste the Excel equation, but obviously doesn't work.


      This is what I have right now,


      event.value = sum (Text10*25+Text24*40+Text25*50+Text26*40+Text27*30+Text28*20+Text29*20+Text30*20+Text31*2 0+Text32*15+Text33*15+Text34*10+Text35*10);


      But something is missing, because it is only showing the quantity sold, not the total price of the total sold.


      Any help would be much appreciated.


      Sorry if it has been solved before. I tried searching and some threads are close, but they include a separate "price" field and this isn't set up like that.

        • 1. Re: Custom calculation in Acrobat 8
          gkaiseril MVP & Adobe Community Professional

          You are using Acrobat Forms and there is no builtin function called 'sum' in Acrobat. That function is only available in LiveCycle Designer. Also you need to obtain the field object's value and not the field's name to perform any calculation using the field's value. So you can create a function to compute the value of the quantity field's value and price and then sum the results.


          // document level function

          function Extend(sFieldName, fPrice) {
          // function to extend the value of the sFieldName times the fPrice
          var fExtend = Number(this.getField(sFieldName).value) * Number(fPrice)
          return fExtend;
          } // end extend function

          // end document level function


          // custom field level calculation

          event.value = Extend('Text10', 25) + Extend('Text24', 40) + Extend('Text25', 50) + Extend('Text26', 40) + Extend('Text27', 30) + Extend('Text28', 20) + Extend('Text29', 20) + Extend('Text30', 20) + Extend('Text31', 20) + Extend('Text32', 15) + Extend('Text33', 15) + Extend('Text34', 10) + Extend('Text35', 10);

          // end custom level calculation


          You will need to 'Enable Reader From Rights' or your users with Reader will not be able to save the form.


          EC-414-32 W

          1 person found this helpful
          • 2. Re: Custom calculation in Acrobat 8
            ashalles123 Level 1

            You are amazing! and so is Javascript. Thank you from our Pack! It will make it so easy to compile the information now.

            • 3. Re: Custom calculation in Acrobat 8
              ashalles123 Level 1

              also, thanks for the reminder about enabling the reader's rights...I had that happen with some regular registration forms.