Expression to evaluate if text string


#1

image

how do you calculate if a text string equals another text string?


#2

You need to add quotes to your string. Try x === "Milk"


#3

To expand on micarts answer a bit, you basically have two options. Either you hard code the text string in the expression node. This would look something like this:

The other alternative is to compare two variables. Anything in the expression node not written inside quotations (or is a number) is made into a variable and you can connect up String nodes to those inputs. Like this:

Also note that the comparison will be case sensitive. As you see in my examples both generate ‘false’ because I’ve set the first input to “milk” and the second variable to “Milk”.