10 Replies Latest reply on Jul 25, 2015 3:29 PM by try67

    Nested If statement confusion

    Sean.twyman Level 1

      so i have a clock in field and a clock out field and a third field that should show the number of minutes between the 2. However if the difference is 10 min or less then i want it to show the actual minutes but if it is 11 min or over just show "10". Here is what I have so far but i am confused on why it is not working and how to fix it. I am getting syntax error 17 at line 18

       

      var strStart = this.getField("Break1O").value;
      var strEnd = this.getField("Break1I").value;
      strStart = strStart + " 1/1/70";
      strEnd = strEnd + " 1/1/70";
      
      
      if(strStart.length && strEnd.length)
      {
        var timeStart = util.scand("h:MM tt m/d/yy", strStart);
        var timeEnd = util.scand("h:MM tt m/d/yy", strEnd);
        var diff = timeEnd - timeStart;
        var oneHour = 60 * 1000;
        var timeleft = (diff/oneHour);
        if (timeleft < 10);
          {  
          event.value = timeleft;
          }
          else
          {
          event.value = 10
          }
      else
        event.value = 0
      
      
      ;