Variable not evaluating to NOT_SET

Hey everyone,

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.

Hello,

You may try with IsNotSetOrEmpty()
This will manage both NOT_SET (null) and empty strings.

Regards,

Thanks Jerome,

Reading my message back I am not sure if it was clear enough, even for myself to understand :slight_smile:
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.

That is why I was trying to use the IsSet()

Does this make sense? :slight_smile:

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.

Regards,

Ok, understood.

I will test using Length, that might just be the answer for the whole thing :slight_smile: Thanks so much for your help on this Jerome :slight_smile:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.