6 Replies Latest reply on Jan 13, 2015 11:45 AM by MzHeather

    Custom Calculation Script Help

    MzHeather

      I am in need of the correct calculation script in order to complete:

       

      I am making an evaluation form. This form contains several columns that indicate a point system. Column 1 = 1 point, Column 2 = 2 points, etc.

      I need to be able to have a user mark an "X" in each form field and have the value predetermined depending on which column they marked the "X" in. Example: They mark an "X" in one of the form fields in Column 2, that form field should then have a value of 2 and be inputted into the Sub Total form field. Then I will need all of the values totaled and added into each Sub Total field for each column. Can someone please provide the calculation script to enable this to happen?

       

        • 1. Re: Custom Calculation Script Help
          gkaiseril MVP & Adobe Community Professional

          This requires use of the Simplified Field Notation or a Custom Calculation JavaScript. Both methods require use of the specific field name of each cell in each column.

           

          This is an example for why form design and planning is important. Some planning about the field naming can make the scripting easy or hard.

          • 2. Re: Custom Calculation Script Help
            MzHeather Level 1

            I'm pretty sure I understand how it works but I unfortunately do not have much knowledge about scripting in general. Can you please provide the script that I would need to use to make this happen? And on what field I should be inputting the script? I feel like there are quite a few variables to what I am trying to accomplish and maybe having to input script into several fields to make it work?

            • 3. Re: Custom Calculation Script Help
              gkaiseril MVP & Adobe Community Professional


              The calculation scripts would be various subtotal fields. Each column's subtotal would add the values of each individual from field in the column.

               

              Pretty hard to provide any script that accesses specific fields with field names.

              • 4. Re: Custom Calculation Script Help
                MzHeather Level 1

                Right, so each Sub Total field will need to have a calculation script added to it to add the values of each field in each column. That part I can use from the pre-set calculations.

                 

                But I want the Sub Total field to recognize the value without the user having to input an actual number, just an "X". So anytime theres an "X", the value of the column (1 pt, 2 pts, 3pts, etc.) should then be added into the appropriate Sub Total field. I also it to total the values together for each column. Is this possible?

                • 5. Re: Custom Calculation Script Help
                  gkaiseril MVP & Adobe Community Professional


                  Have you tried to use the pre-set calculation for "Field is the Sum of the following fields:"?

                   

                  But you cannot use that calculation option if you want to multiply the result by a weighting factor.

                   

                  So if you had used check boxes, you could assign the weighting factor for the export value of the check box. Then you could use the "Field is the Sum of the following fields:" and get the desired value. And then one can use the "Field is the Sum of the following fields'" for the total. The pre-defined script ignores non-numeric values for the unchecked fields.

                   

                  Not using this approach means one has to check each text field for a value of "X" and then count them and multiply by the weighting value or summing the weighting value for each "X".

                   

                  Scripting like programing requires very detailed information about the objects and how to process them.

                  • 6. Re: Custom Calculation Script Help
                    MzHeather Level 1

                    You know, I've been debating whether it would work better if I used checkboxes. I'll try that instead, thanks!