Hello Ignition forums!
I’m still new to this scripting, bare with my lack of knowledge.
I’ll state my goal; I would like to have an indicator activate when ANY of the following conditions is true.
PP = Parts Present
I have PP1 through PP9 and need the indicator to show when ANY of the sensors have a part present.
This is the approach I took.
// If I use only the first IF statement it works.
// Anytime I add more than one IF or OR the expression derps out.
// UPDATE: I am receiving String Const Errors
if ({ST2010RA_PU/Parts Present/1stPP Ind 0},
‘(255,255,0)’, // True return GREEN
‘(71,255,255)’ // False return BLUE
)
| | ({ST2010RA_PU/Parts Present/2ndPP Ind 0},
‘(255,255,0)’, // True return GREEN
‘(71,255,255)’ // False return BLUE
)
| | ({ST2010RA_PU/Parts Present/3rdPP Ind 0},
‘(255,255,0)’, // True return GREEN
‘(71,255,255)’ // False return BLUE
)
4thPP Ind 0, 5thPP Ind 0 etc, are done similarly.
1 Like
I’ve had a similar problem. Instead of using ORs try this
if expression
statements
elif expression
statements
elif expression
statements
elif expression
statements
you can see more on this syntax here
1 Like
I gave it a go but now I’m receiving a Bound Const Problem. Hopefully this image helps.
I thought you were scripting, this is an expression. The expression binding has it’s own functions, and elif isn’t one. Can you post a pic of your original code. thanks
1 Like
The original coding was ||'s instead of elif’s, and I knew it wouldn’t take me long to make a goof out of myself on here.
thank you for clarifying the difference.
From what I can tell from your code you should do this instead....
if( condition || condition2 || condition 3, true statement, false statement)
1 Like
Oh woah, that makes a lot more sense. I need to work on my habits, I probably would’ve been able to see that if I wrote it out neater. Thank you so much dkhayes ^_^. Just a final quesiton, this task is more suited for an expression correct?
An expression is fine. Any time you post code enclose the code with ["code"] and ["/code"] to format it. Exclude the quotes, I put them in so you can see the text. using the expression binding, click on the fx on the right side of the window will open a list of the expression functions and their syntax
1 Like
Awesome man, thank you for the know hows
, This will definitely come in handy in the future, take it easy friend!
1 Like