6 Replies Latest reply on Mar 15, 2015 2:48 AM by Bloodywog

    Custom calculation  - Multiple If Statements

    Bloodywog

      Hi Guys

       

      I'm stuck with a simple If Statement. New to JavaScript.

       

      I have a "Age Field" text field, "Gender" Drop Down field and "Risk" text field.

      In the "Risk" text field I need to have a Custom calculation script to find out if "Male" >= 45 or Female >= 55, +1 Risk.

       

      I currently have using this:

      event.value = "";

      var a = +this.getField("Age").value

      var b = +this.getField("Gender").value


      if (a>=45 && b="Male") event.Value = "+1"

      else if (a<=45 && b="Male") event.Value = "0"

      if (a>=55 && b="Female") event.Value = "+1"

      else if (a<=55 && b="Female") event.Value = "0"

       

      Any help will be appreciated.