5 Replies Latest reply on Apr 11, 2013 3:32 PM by George_Johnson

    Formula not working in Adobe FormsCentral

    sublogic

      I have a formula which I have embeded into my PDF Form using Adobe Acrobat. All is fine and dandy in Acrobat, but the formula does not work when it is imported and converted for FormsCentral, I have to manually calculate the formula into the field which completely throws a wrench into the automation process that I am trying to create. My job is to issue Certificates of Completion, the form I have created has fields where I can submit the name, address, and use a formula to calculate the overall GPA to see if the person qualifies.

       

      FormsCentral gives you the ability to export your collected responses into a spreadsheet for Excel. By submitting the address along with the name and qualifications, I am able to use this data to create and automate shipping labels for all qualified students using Excel and Word in an instant. Having to manually calculate this data can result in human error, such instances can occur if you're processing over a hundred certificates per quarter.

       

      My initial impress that I got from upgrading to the premium version of FormsCentral was that I would be able to collect the same data that I have setup in my PDF form using Acrobat, but that doesn't seem to be the case.

       

      Formulas are by far the most important feature to have in my opinion as they are used for automating a workflow and eliminating human error.

        • 1. Re: Formula not working in Adobe FormsCentral
          George_Johnson MVP & Adobe Community Professional

          If you're using a custom JavaScript, can you post what you're using? If not, can you explain exactly how you have it set up to do the calculation? They can work, so I suspect there's a problem with either the form or the application you're using to view the PDF (e.g., something other than Adobe Reader/Acrobat, as with some browsers).

          • 2. Re: Formula not working in Adobe FormsCentral
            sublogic Level 1

            Hello George,

             

            I am not using a Javascript but in Acrobat XI, there is a "Calculate" tab in the Properties field at the end. I have selected to utilize the "Simplied Field Notation" with the following formula:

             

            (Crim_I_Grade + Crim_II_Grade + Sight_C_Grade) / 3

             

            For each course grade, I have created a drop-down menu with values ranging from A (4.00) to F (0.00) then divide it by 3, to give me the overall GPA calculation.

             

            I'm assuming since FormsCentral is a desktop and web application, the preferred method is to utilize a Javascript. My initial impression was that FormsCentral inserts the Javascript for you.

             

            Is there a tutorial on how this can be accomplished?

             

            Thank you.

            • 3. Re: Formula not working in Adobe FormsCentral
              George_Johnson MVP & Adobe Community Professional

              All calculations in a PDF are JavaScript-based, regardless of which option you choose, so that's not the problem. The first thing to check is that you're using either Reader or Acrobat to view the form. Some browsers, such as Chrome and Firefox, have built-in PDF viewers that have either limited or no support for forms and/or JavaScript. Other PDF viewers such as Preview on the Mac have no support for JavaScript and lousy support for PDF forms.

               

              Another potential problem is apparently you're using export values for the dropdown items. They are not supposed to be allowed with FormsCentral and you used to get a warning about this when you uploaded and distributed the form via FormsCentral. If that's the case you will have to use a custom calculation script after removing the export values. The script would associate a grade with each item in the dropdown and calculate accordingly. I can suggest a script that will work if you provide the complete list if items in the dropdown.

              • 4. Re: Formula not working in Adobe FormsCentral
                sublogic Level 1

                You were right about receiving a warning, I figured it had to be something with exporting values, but could not find an alternative solution to calculating a formula in FormsCentral.

                 

                My GPA Dropdown list is as follows:

                 

                A+  =   4

                A    =   4

                A-   =   3.7

                B+  =   3.3

                B   =   3

                B-  =   2.7

                C+  =  2.3

                C  =   2

                C-  =  1.7

                D+  =  1.3

                D  =  1

                D-  =  0.7

                F  =  0

                 

                A student must pass three courses to be eligible for a Certificate of Completion which is where the formula (Crim_I_Grade + Crim_II_Grade + Sight_C_Grade) / 3 comes from.

                 

                i.e.

                 

                https://www.evernote.com/shard/s273/sh/e7865cb7-d80f-4da6-a052-397d6efd14a4/e7b09a29b58c8fb5bdc924bfa63beb36/res/26aada71-324d-4af0-8d4b-f518be39d17b/skitch.png

                 

                Thank you for any help!

                • 5. Re: Formula not working in Adobe FormsCentral
                  George_Johnson MVP & Adobe Community Professional

                  OK, here's a custom calculation script you can use in the text field after you remove the export values from the dropdowns:

                   

                  // Custom calculation script for text field

                  (function () {

                   

                      // Object to associate a letter grade to a numeric value

                      var oGrades = {

                          "A+": 4, "A": 4, "A-": 3.7,

                          "B+": 3.3, "B": 3, "B-": 2.7,

                          "C+": 2.3, "C": 2, "C-": 1.7,

                          "D+": 1.3, "D": 1, "D-": 0.7,

                          "F": 0

                      }

                   

                      // Get the field values from the dropdowns

                      var v1 = getField("Crim_I_Grade").value;

                      var v2 = getField("Crim_II_Grade").value;

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

                   

                      // Get the corresponding numeric values from the Grades object

                      // Default to 0 if the letter grade isn't found in the object

                      var v1a = oGrades[v1] || 0;

                      var v2a = oGrades[v2] || 0;

                      var v3a = oGrades[v3] || 0;

                   

                      // Calcualte and set this field's value, rounded to two decimals

                      event.value = util.printf("%.2f", (v1a + v2a + v3a) / 3);

                   

                  })();

                   

                   

                  This isn't necessarily the most efficient code, but I wanted to make it easy to follow. It rounds the result to two decimal places. Let me know if you have any questions about it.