Skip to main content
Participant
September 7, 2016
Question

Conditional If/Else statement using two conditions

  • September 7, 2016
  • 1 reply
  • 2015 views

Hello,

I am trying to write a conditional if/else statement that puts a text value in a box 3 when specific conditions in box 1 and box 2 are met. Box 1 and 2 are drop down boxes with set values.

I've tried searching all over the web and have probably rewritten it at least 10 different times. At one point I was able to get it working with only one of the boxes factored into the code but my computer crashed and I lost that part.

Here's what I have:

var n1 = this.getField("likelihood").value:

var n2 = this.getField("consequence").value;

if ((n1.value=='N/A') && (n2.value=='N/A')) {

     event.value = 'N/A'

} else if ((n1=='Not Likely') && (n2=='Insignificant') {

     event.value = 'Low'

}

This would continue on another 14 times to account for the various combinations that can be chosen using box 1 and box 2. I have also tried placing it in the 2nd combo box as an action item but still no luck. Any help would be much appreciated.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 7, 2016

n1 and n2 are already the value of the fields, so why are you trying to access the value property again in the first if-statement?

CN0001Author
Participant
September 7, 2016

Oops that's a typo. It should say n1 and n2 like the else if statement.

try67
Community Expert
Community Expert
September 7, 2016

So post the actual code, and also specify where you're using it. The code you posted above should be used a custom calculation script of some field.