Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
If-else not evaluating correctly in app builder method
Posted May 9, 2016, 11:39 a.m. EDT Simulation Apps Version 5.2 1 Reply
Please login with a confirmed email address before reporting spam
I am using a combo box to plot different graphs depending on which option the user chooses from the combo box. To do this, I created a very simple method with some if-else statements. The given parameter for combo box methods is newValue, and it's a string. My if-else statements follow the pattern:
if (newValue == "varName1") {
// do something
} else if (newValue == "varName2") {
// do something else
} else if .....
For whatever reason, these statements are not evaluating correctly. To test that newValue has the value that I think it does, I put newValue a confirm dialogue box. For example, one of the options from my choice list is "Plot Electrical Potential" with a variable name of plotEP. The dialogue box pops up correctly, saying "plotEP" on it, but the if statement -- if (newValue == "plotEP") -- evaluates to false.
I realize this is a very simple issue but I don't know what could be going wrong. Thanks.
if (newValue == "varName1") {
// do something
} else if (newValue == "varName2") {
// do something else
} else if .....
For whatever reason, these statements are not evaluating correctly. To test that newValue has the value that I think it does, I put newValue a confirm dialogue box. For example, one of the options from my choice list is "Plot Electrical Potential" with a variable name of plotEP. The dialogue box pops up correctly, saying "plotEP" on it, but the if statement -- if (newValue == "plotEP") -- evaluates to false.
I realize this is a very simple issue but I don't know what could be going wrong. Thanks.
1 Reply Last Post May 10, 2016, 4:08 p.m. EDT