# Switch Node failing to meet the case

**URL:** <https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434>\
**Category:** Help\
**Tags:** dashboard, workflow\
**Created:** [November 27, 2020, 9:43pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434 "2020-11-27T21:43:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Assouad](https://avatars.discourse-cdn.com/v4/letter/n/41988e/32.png) [@Nicolas\_Assouad](https://forums.losant.com/u/Nicolas_Assouad)\
**Post date:** [November 27, 2020, 9:43pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/1 "2020-11-27T21:43:17Z")

</div>

Hello,

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/6/6f3f8b813528701b1a1ffed495fe6d251ba2a07a.png)

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

works fine…

Thanks

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [November 27, 2020, 11:14pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/3 "2020-11-27T23:14:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Nicolas\_Assouad](https://avatars.discourse-cdn.com/v4/letter/n/41988e/32.png) [@Nicolas\_Assouad](https://forums.losant.com/u/Nicolas_Assouad)\
**Post date:** [November 28, 2020, 12:57am UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/4 "2020-11-28T00:57:25Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/4/4e92e72f53f35711f0fa0025db45b12e3b784038.png)

Thanks for all the help

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [November 28, 2020, 3:31am UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/5 "2020-11-28T03:31:32Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/6/654eaf5c8c3b5f8492f881061ae5b3549efa9996.png)

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

---

<div class="post-metadata">

**Author:** ![MXBS13](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/mxbs13/32/379_2.png) [@MXBS13](https://forums.losant.com/u/MXBS13)\
**Post date:** [August 25, 2021, 6:12am UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/7 "2021-08-25T06:12:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 25, 2021, 11:22am UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/9 "2021-08-25T11:22:28Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![MXBS13](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/mxbs13/32/379_2.png) [@MXBS13](https://forums.losant.com/u/MXBS13)\
**Post date:** [August 25, 2021, 5:35pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/10 "2021-08-25T17:35:44Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/1/1912e177f4c3a2e0df167689af5574960002eb96.png)

And here’s the switch:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/4/4d1cbd13e1c82433fb77f19676c58f34ed87659a.png)

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 25, 2021, 9:43pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/11 "2021-08-25T21:43:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 25, 2021, 9:55pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/12 "2021-08-25T21:55:09Z")

</div>

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](https://docs.losant.com/workflows/logic/date-time/) 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. 🙂

[Screen Shot 2021-08-25 at 5.53.03 PM|690x376](https://forums.losant.com/uploads/short-url/2rSkwWS8d3WjkKG3MBSHx89p9q3.png)

---

<div class="post-metadata">

**Author:** ![MXBS13](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/mxbs13/32/379_2.png) [@MXBS13](https://forums.losant.com/u/MXBS13)\
**Post date:** [August 26, 2021, 3:13am UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/13 "2021-08-26T03:13:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MXBS13](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/mxbs13/32/379_2.png) [@MXBS13](https://forums.losant.com/u/MXBS13)\
**Post date:** [August 26, 2021, 3:25am UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/14 "2021-08-26T03:25:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 27, 2021, 2:10pm UTC](https://forums.losant.com/t/switch-node-failing-to-meet-the-case/3434/15 "2021-08-27T14:10:48Z")

</div>

@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](https://forums.losant.com/uploads/short-url/syAkYTlwhbU8YG4aDrgxisK6729.flow) (10.0 KB)
