Configure Expression Binding

Hello guys,
I am trying to display different “strings” for a label to display states.
Using - Configure Expression Binding.
Maybe this is the incorrect way to do it? I could use some help.

IF (
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[4]} = false) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[5]} = false) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[6]} = false),“NO MODE SELECTED”,0)
||
IF (
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[4]} = false) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[5]} = true) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[6]} = false),“FILL MODE SELECTED”,0)
Error_ExpressionEval.

Personally for what your doing, I think a case statement with a binary encoder is more fitting. But I will give an example doing it with if’s and with a case statement. With the if’s, you shouldn’t need the or, you just need to carefully stack them to make it an if/else if. Using case though will be less lines making it easier to add to it or change it later.

The or(||) in the expression is for comparing two values in order to return a true or false, it won’t work for returning a string value based on your two if’s.

# if you want to use if statements
if(
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[4]} = false) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[5]} = false) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[6]} = false),"NO MODE SELECTED",
if(
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[4]} = false) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[5]} = true) &&
({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[6]} = false),"FILL MODE SELECTED",""))

#same thing using a binary encoder and a case statement
case(
binEnc({[default]Line 3 Filler/Line 3 Production Selection/B20_3_[4]},{[default]Line 3 Filler/Line 3 Production Selection/B20_3_[5]},{[default]Line 3 Filler/Line 3 Production Selection/B20_3_[6]})
,0,"NO MODE SELECTED"
,2,"FILL MODE SELECTED"
,"")
2 Likes

Thank you very much!