I am trying to figure out why a variable would not be evaluated as NOT_SET in a Switch setting.
I have webchats coming in, and they might contain different variables. I need to check if the variables are set or not before deciding what to do with them.
I use Get Participant Data to populate a variable form context variables.
Then I just use a Switch to check with: IsSet(State.Variable), and it always evaluates to True, even if the original context variable was empty.
I am probably misunderstanding how this works, but if anyone has any insight into why this might not be working I would be very grateful.
Reading my message back I am not sure if it was clear enough, even for myself to understand
I have a Switch, and I am trying to evaluate three variables. The most important one first.
So I need to know if the variable is anything OTHER than NOT_SET or NULL Because I always want to use Variable1 if it contains a value, If not then check if Variable2 is populated etc.
Maybe just using Regex to match a 10 digit number would be better in this case? Since I just need it to be a 10 digit number to evaluate to True. Anything else would be False
I think it is always better to start with a IsNotSetOrEmpty() to test null/empty first.
As NOT_SET and empty string would be equivalent for you (not valid), that should be transparent.
Reason is that (I don't know in your case with WebChat) depending on what you are doing, the outcome could be an empty string or a NOT_SET (Data Action, Get Participant Data, ...).
I don't think there is a regex comparison/function in Architect. But may have missed it as I haven't played with variable manipulation for. while.
If not there, you could still start with a test on Length.