5 Replies Latest reply on Aug 9, 2013 12:01 AM by mrfale67

    If/then Statement Help

    Ercanli

      My text field has a number which is the sum of several fields. I now want to have this numerical value to automatically translate into an “X” for one of the three check boxes below it.

       

      Such as: 

      If total score is > 75 = GO (box will be checked)

      If total score is 50-75 = GO with review (box will be checked)

      If total score is < 75 = NO/GO (box will be checked)

       

      Go_NoGo_Process_Sample_for_AdobeForum.jpg

       

      Thank you in advance!

        • 1. Re: If/then Statement Help
          mrfale67 Level 2

          This a possible way to do what you ask:

           

          var f1 = this.getField("Chk1");

          var f2 = this.getField("Chk2");

          var f3 = this.getField("Chk3");

           

          if (totalS > 75) {

          f1.checkThisBox(0,true);

          f2.checkThisBox(0,false);

          f3.checkThisBox(0,false);

          }

          else if (totalS >50 && totalS<75) {

            f1.checkThisBox(0,false);

            f2.checkThisBox(0,true);

            f3.checkThisBox(0,false);

            }

          else if (totalS < 50) {

            f1.checkThisBox(0,false);

            f2.checkThisBox(0,false);

            f3.checkThisBox(0,true);

            }

          • 2. Re: If/then Statement Help
            try67 MVP & Adobe Community Professional

            You haven't defined the totalS variable anywhere...

            • 3. Re: If/then Statement Help
              mrfale67 Level 2

              He/She should customize my sample code at his/her needs. Therefore, I suggest him/her to have a look at the Adobe JS API Reference. The "Field" section in particular.

               

              PS: totalS is the total score he/she already calculated somehow as a sum of...several fields...

              • 4. Re: If/then Statement Help
                Ercanli Level 1

                Hi! - Well, this is a he and I am not sure what I'm doing. I don't think I am capable of customizing anything. I was wondering if there is a script that I could copy paste into calculation section. Is there? I hope so.

                 

                I appreciate you guys helping me out. I really do. I've check this discussion like hundred times since yesterday and I am still hopeful that you guys can help me out. Because I go, "totalS?! customize?! Adobe JS whaat?!

                • 5. Re: If/then Statement Help
                  mrfale67 Level 2

                  Hi Ercanli,

                  you said you have a field "which is the sum of several fields". So, just add this initialization at the beginning of my sample code:


                  var totalS = this.getField("how_you_called_the_sum").value;