8 Replies Latest reply on Nov 8, 2016 1:48 PM by davidm76220796

    Conditional AND making Background Color change

    davidm76220796 Level 1

      First of all it really sucks being ignorant.  BUT, I am really grateful for the help offered here, so Thank You!!

       

      I have created two Document Javascripts with an array of field names. 

       

      Here is one...

       

      function AddGPM()

      {

       

          // Set up an array of field names

          var aNames = ["N36", "N37", "N38", "N39",

          "N40", "N41", "N42", "N43",

          "N44", "N45", "N46", "N47",

          "N48", "N49", "N50", "N51",

          "N52", "N53", "N54", "N55"];

       

          // Set up an object that will be returned

          var oValsGPM = {};

       

          // Loop through the field names and add name/value pairs to the object

          for (var i = 0; i < aNames.length; i += 1) {

              oValsGPM[aNames[i]] = getField(aNames[i]).value;

          }

       

          return oValsGPM;

      }

       

      Here is the other...

       

      function AddPressure() {

       

          // Set up an array of field names

          var aNames = ["Red10", "Red20", "Red30", "Red40",

          "Brown10", "Brown20", "Brown30", "Brown40",

          "Grey10", "Grey20", "Grey30", "Grey40",

          "White10", "White20", "White30", "White40",

          "Blue10", "Blue20", "Blue30", "Blue40"];

       

      // Set up an object that will be returned

          var oValsPressure = {};

       

          // Loop through the field names and add name/value pairs to the object

          for (var i = 0; i < aNames.length; i += 1) {

              oValsPressure[aNames[i]] = getField(aNames[i]).value;

          }

       

          return oValsPressure;

      }

       

      I am trying to change the background color of the field depending upon the value being greater or = to a value AND less than another value  AND

      being dependent upon a different field being greater or = to yet another field.

       

      var oVP=AddPressure();

      var oVG=AddGPM();

      var P28=this.getField ("P28").value;

      var L30=this.getField("L30").value;

      if(P28>=(oVG["N36"])

      AND

      (oVG["N37]))

      AND

      (oVP["Red10"]>=("L30")){

      event.target.fillColor=color.yellow;

      return;

      }

       

      I keep getting syntaxerror messages.

       

      Where am I messing up?