2 Replies Latest reply on Apr 9, 2016 8:28 AM by gkaiseril

    Percentage calculation slow to display


      I have a form with a lot of tables, some of which need to calculate percentages of dollar values. One such table has 5 fields for dollar amounts and 5 fields for percentages. There aren't fields within the table for the result of the calculations between the dollar amounts and percentages so I have created 5 hidden fields that do the calculations and then the 5 values in those fields are added together with a simple sum calculation. The total of that calculation is reflected in a Balance Sheet.


      Below is the custom calculation script I'm using to calculate the dollar amounts and percentages.


           event.value = this.getField("$Sch5.PrtnrshpLoan1").value * this.getField("Sch5.PrctOwned.0").value / 100.0;


      The script seems to work fine and the total of the 5 hidden fields displays in the Balance Sheet correctly the first time. The problem comes if the user needs to go in and change one or more of the percentages. The Balance Sheet doesn't update the total to reflect the percentage change unless the user does something further along in the document.


      I believe I read somewhere in a forum that there's a way to force a calculation to be immediate and thought I had made a note of it but I can't seem to find it now. Does anyone know what I'm talking about and can shed some light on what I need here?




        • 1. Re: Percentage calculation slow to display
          George_Johnson MVP & Adobe Community Professional

          You need to make sure the field calculation order is set so it makes sense for your form. Exactly how you do this depends on which version of Acrobat you're using.


          Acrobat 9: Forms > Add or Edit Fields     and then: Forms > Edit Fields > Set Field Calculation Order

          Acrobat 10: Tools > Forms > Edit     and then: Tasks > Other Tasks > Edit Fields > Set Field Calculation Order

          Acrobat 11: Tools > Forms > Edit     and then: Tasks > Other Tasks > Set Field Calculation Order

          Acrobat DC: Tools > Prepare Form     and then: More > Set Field Calculation Order

          • 2. Re: Percentage calculation slow to display
            gkaiseril MVP & Adobe Community Professional

            Depending upon how many form fields are being recalculated and how you have set up these calculations can affect the speed of the calculations.


            It also looks like you are are entering a percentage as whole number and not a decimal. I would use the decimal format ft the ownership percentage. The displayed value will be multiplied by 100 and have the '%" symbol adde to the displayed value. Calculations will use the decimal value and require no additional scripting.


            You might also gain some processing speed by analyzing the calculations scripts and changing them to validation or exit scripts if they only need be run on that field if that field value changes and not every time any field used in a calculation is updated.