1 Reply Latest reply on Nov 20, 2010 12:25 PM by Steve L Walker

    how to use if statement

    Gee68 Level 1

      I am trying to Date2Num but only wnat to display the Date2Num greater than 30 days, because i am going to use that to multiply other numericfields.

      with help of some genius I have come up with the NumOfdays formula but need the if statement. thanks

       

       

      NumOfDays=Date2Num(endDate.rawValue,"YYYY-MM-DD")- Date2Num(startDate.rawValue,"YYYY-MM-DD")

       

      Var  NumOfDays = event.target;

      If (NumOfDays> 30) then

      NumOfDays = NumOfDays - 30

      NumOfDays.textColor = color.red;

       

      else

      NumOfDays = “ “

      NumOfDays.textColor = color.black;

       

       

        • 1. Re: how to use if statement
          Steve L Walker Level 5

          Here's my FormCalc version.

           

          var numOfDays = Date2Num(endDate.rawValue,"YYYY-MM-DD") - Date2Num(startDate.rawValue,"YYYY-MM-DD")

           

          if (numOfDays > 30) then

            NumOfDays.rawValue = numOfDays - 30

            xfa.resolveNode("NumOfDays.ui.#textEdit.border.fill.color").value = "255,0,0"

          else

            NumOfDays.rawValue = null

            xfa.resolveNode("NumOfDays.ui.#textEdit.border.fill.color").value = "255,255,255"

          endif

           

          Steve