Expand my Community achievements bar.

if-then statement: mulitple then conditions

Avatar

Former Community Member

I am developing a form with a text field that is calculated. My intent is for it to reference whether or not a list of number fields fall within a certain range.  If it does then the text field populates with PASS in black letters, if not it should populate with FAIL in red letters.  I thought of using a if-then statement to determine this.  I am using formcalc.

//Determines whether a PASS, FAIL, or NULL condition exists

if ((FS270Pt1 >= 28.5) and (FS270Pt1 <= 38)

          and (FS270Pt2 >= 28.5) and (FS270Pt2 <= 38)

          and (FS270Pt3 >= 28.5) and (FS270Pt3 <= 38)

          and (FS270Pt4 >= 28.5) and (FS270Pt4 <= 38)

          and (FS270Pt5 >= 28.5) and (FS270Pt5 <= 38)

          and (FS270Pt6 >= 28.5) and (FS270Pt6 <= 38)

          and (FS270Pt7 >= 28.5) and (FS270Pt7 <= 38)

          and (FS270Pt8 >= 28.5) and (FS270Pt8 <= 38)

          and (FS270Pt9 >= 28.5) and (FS270Pt9 <= 38)

          and (FS270Pt10 >= 28.5) and (FS270Pt10 <= 38)

          and (FS270Pt11 >= 28.5) and (FS270Pt11 <= 38)

          and (FS270Pt12 >= 28.5) and (FS270Pt12 <= 38)

          and (FS270Pt13 >= 28.5) and (FS270Pt13 <= 38)

          and (FS270Pt14 >= 28.5) and (FS270Pt14 <= 38)

          and (FS270Pt15 >= 28.5) and (FS270Pt15 <= 38))

          then this = "PASS"

elseif ((FS270Pt1 < 28.5) | (FS270Pt1 > 38)

          | (FS270Pt2 < 28.5) | (FS270Pt2 > 38)

          | (FS270Pt3 < 28.5) | (FS270Pt3 > 38)

          | (FS270Pt4 < 28.5) | (FS270Pt4 > 38)

          | (FS270Pt5 < 28.5) | (FS270Pt5 > 38)

          | (FS270Pt6 < 28.5) | (FS270Pt6 > 38)

          | (FS270Pt7 < 28.5) | (FS270Pt7 > 38)

          | (FS270Pt8 < 28.5) | (FS270Pt8 > 38)

          | (FS270Pt9 < 28.5) | (FS270Pt9 > 38)

          | (FS270Pt10 < 28.5) | (FS270Pt10 > 38)

          | (FS270Pt11 < 28.5) | (FS270Pt11 > 38)

          | (FS270Pt12 < 28.5) | (FS270Pt12 > 38)

          | (FS270Pt13 < 28.5) | (FS270Pt13 > 38)

          | (FS270Pt14 < 28.5) | (FS270Pt14 > 38)

          | (FS270Pt15 < 28.5) | (FS270Pt15 > 38))

          then this = "FAIL"

elseif (FS270Pt1.isNull|FS270Pt2.isNull|FS270Pt3.isNull|FS270Pt4.isNull|FS270Pt5.isNull|FS270Pt6.isNull|FS270Pt7.isNull|FS270Pt8.isNull|FS270Pt9.isNull|FS270Pt10.isNull|FS270Pt11.isNull|FS270Pt12.isNull|FS270Pt13.isNull|FS270Pt14.isNull|FS270Pt15)

  then this = null

endif

What I thought would work was changing the "then" statement to read:

then this = "PASS" and this.fontColor = "0,0,0"

then this = "FAIL" and this.fontColor = "255,0,0"

How can I make this work?

0 Replies