I have a strange thing in a simple switch tool.
I have a numbers as input. I have to compare it, because I have 3 cases: less than 90, [90-120] and greater than 120.
The module gives right case in logs, but I always get isElse=true. I’ve tried to make parseNumber, I’ve tried some other math formulas.
The thing is that switch shows right pattern, but also gives Else Output as a result. I have no idea why. And I don’t want to use Router with filters.
See screenshots, that is the case with 56 as input.
Even if I add the 3rd case that number is >=90 and <= 120 — that means that Else never occurs, I still have Else Output
Hey @khabaroff,
I think the switch module works a little different from what you think.
Your input is „56“
This module then checks: „is input = pattern?“
In your example your pattern „56 < 90“ comes out as „true“.
Is 56=true? No it’s not.
What you would need to do is the following.
If(Total>120;“greater than 120“; if(Total <90;“smaller than 90“; „in between“))
Into the switch-cases (patterns) you now write
- „greater than 120“
- „smaller than 90“
- „in between“
And the corresponding output.
This way it should work
I hope it helps!
Best,
Richard
3 Likes
Thank you for your reply! I will try, it makes sense now.
I thought that something in pattern
Meanwhile I asked ChatGPT to make an regexp pattern for searching numbers as expressions, haha
3 Likes