Switch Node failing to meet the case

Hello,

Need to understand why the switch is not honoring the case of status

The conditional statement using the same {{ data.body.request.intent.slots.listOfCommands.value }}

works fine…

Thanks

It looks like you may have a leading space in front of "status".

  • "status"
  • " status"

Can you double-check that field for any trailing or leading white space and see if that helps resolve the issue?

Sorry no blank prior to status… Tried zillion of cases ===“status”, “status”, status, =status… I agree it should be ‘status’ based on the docs… does not work… maybe should log out back in… Got the problem yesterday with webhook supplying the wrong data… Logged out back in… everything worked fine

Thanks for all the help

Based on the screenshot, everything appears to be configured correctly. As a test, I placed the same value at the same payload path to try the Switch Node myself.

I’ll open up a DM with you to obtain further information useful for debugging that you may not want to share publicly.

Hi,
Was your issue solved? I am having the same problem, I’ve checked for spaces I might have missed, spelling, and different ways to write it, but somehow it is going to Default instead of meeting the case.

What was your solution? If I may ask

@MXBS13 the solution to the OP’s case is likely different from the case you’re running into. Can you provide us a sample payload, the expression you are attempting to switch on, and the cases, as well as the expected vs. actual behavior?

From what I see it seems similar. But yeah, here’s my situation:
When my webhook is activated it fetches the date from an external website, it stores it in {{hoyEs}} and then I use a string block to truncate the string from {{hoyEs}} and save only the first 3 letters, and then it is stored to {{today}}.
It then goes to the Switch block and should meet the case in “Miercoles”. But I’ve been trying since yesterday when it should have caught the case in “Martes”, but it’s failing.
Again, I checked the spelling, for the string not to be empty, and I see no reason why the case is not being met.

Here’s the path:

And here’s the switch:

I bet it has something to do with that Unicode character. I assume “Lun” and “Mar” are working as expected?

I’ll look into this a bit more and see if I can point definitively to Unicode being the problem, and if so, see if I can find a workaround.

Looking at your workflow, I do have a suggestion that would render this problem moot …

It appears you are using an HTTP Node to fetch the current date and time, and parsing that response as you said to get the day of the week. That day of week is then what you are switching on in the Switch Node, right?

Instead, you could use a Date/Time Node and the “Get Date Part” operation, and choose “Day of Week” for the part to retrieve. (You can set the timezone as well.) What is returned is an integer representing the day of week: 0 for Sunday, 1 for Monday, and so on.

Doing this would speed up your workflow and simplify it; no more expensive HTTP request, no more String Node to parse the day of week, and most importantly, no more Switch Node bug. :slight_smile:

Screen Shot 2021-08-25 at 5.53.03 PM|690x376

Nope, not related. It should work because it’s a string. And no, neither Lun or Mar work :frowning:

Humm… it may work.
The thing is that it retrieves a string I need to use, and in fact I use {{hoyEs}} later in other blocks. But this could work for the Switch, let me try.

@MXBS13 see the attached workflow, where I’ve recreated your conditions.

For me, I’m getting the expected behavior for all seven days, as well as when fetching the day of the week through the HTTP Node.

Can you compare what I have here to what you’re doing and let me know if I’m missing anything? Or perhaps this may lead you to find an issue in your original implementation?

day-switch-develop.flow (10.0 KB)