7 Replies Latest reply on Mar 11, 2011 2:13 PM by KeelyL

    Custom Calculated Field - Script Issues?

    KeelyL

      One of my custom calculated fields is not working correctly and I think it may be a problem with my script. Could someone tell me if this looks okay?

       

      //incentive

      var TFR = this.getField('TFR').value;

      var Cash = this.getField('Rincentive').value;

      var MN = Math.max(1000, Cash);

      var MX = Math.min(3000, Cash);

       

      if(TFR>74){

      if(Cash>0){

      }else if(MN==1000){

      event.value = MN;

      }else if(MX==3000){

      event.value = MX;

      }else{

      event.value = Cash}

      }else{

      event.value = 0}

        • 1. Re: Custom Calculated Field - Script Issues?
          try67 MVP & Adobe Community Professional

          Maybe you should be more specific about what exactly goes wrong.

          • 2. Re: Custom Calculated Field - Script Issues?
            KeelyL Level 1

            The problem field (script above) does not seem to recalculate when changes are made to the referenced fields, thought the calculation order is correct (all other calculations occure before the calculation of this final field).

             

            Here is what I get from the Debugger:

            Acrobat EScript Built-in Functions Version 10.0

            Acrobat SOAP 10.0

             

            SyntaxError: missing ( before condition

            11:

            SyntaxError: missing ( before condition

            11:

            SyntaxError: syntax error

            13:

            SyntaxError: syntax error

            13:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            SyntaxError: missing } in compound statement

            12:

            ReferenceError: even is not defined

            6:Field:Calculate

            ReferenceError: even is not defined

            6:Field:Calculate

            ReferenceError: even is not defined

            6:Field:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            SyntaxError: missing } in compound statement

            13:

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            ReferenceError: even is not defined

            6:AcroForm:mn:Calculate

            • 3. Re: Custom Calculated Field - Script Issues?
              try67 MVP & Adobe Community Professional

              According to these errors the problem is with a script associated with the

              "mn" field.

              1 person found this helpful
              • 4. Re: Custom Calculated Field - Script Issues?
                KeelyL Level 1

                Okay, I resolved the Debugger issue (thanks for pointing out the field reference!) but I'm still having issues with fields not re-calculating whenever the preceeding fields are changed. I've set the calculation order to start with the first fields and work its way down to the final field that should be calculated. It works fine when I input info on a fresh form, but when I modify field values some dependent fields do not update. Any suggestions?

                • 5. Re: Custom Calculated Field - Script Issues?
                  try67 MVP & Adobe Community Professional

                  Check if there are any other error messages in the console.

                  You might want to enable the option to show the console on errors and

                  warnings (Edit - Preferences - JavaScript).

                  • 6. Re: Custom Calculated Field - Script Issues?
                    gkaiseril MVP & Adobe Community Professional

                    You may also want to double check the calculation order of the fields.

                    1 person found this helpful
                    • 7. Re: Custom Calculated Field - Script Issues?
                      KeelyL Level 1

                      I revised a few of the scripts and now everything is working well. Thanks for your suggestions!