Wappler: v7b33
OS: MacOS M1
Server: PHP
Has Select...Case stopped working in beta 33? I've just been trying to work out why a script has stopped returning data and got it working again by changing all the Select...Case to Conditions.
Wappler: v7b33
OS: MacOS M1
Server: PHP
Has Select...Case stopped working in beta 33? I've just been trying to work out why a script has stopped returning data and got it working again by changing all the Select...Case to Conditions.
I switched to the stable extensions once and found that Select case is still only available in the beta extensions.
Hmm. I have beta and experimental both enabled.
I have a theory. You're using ==
for the Conditions, right?
The Select uses ===
(at least on NodeJS)
So, you need to ensure the correct variable types. E.g. for numbers you have to apply the toNumber formatter
Edit: Just made a feature request for something that might help in the future:
What case stopped working for you? What is the expression used?
It was a really simple expression:
This worked perfectly until recently.
I also tried putting {{==1}}
in the case but that didn't work either.
Ok so which part is not working? Are there errors in the server action?
What exactly does queryProduct.prodProductRangeID
when you output it in a setvalue?
It's as if the entire Select
isn't executed. No errors, nothing. I changed it to a series of Condition
and it's working again.
queryProduct.prodProductRangeID
returns an integer - it's an auto-increment index field.
The select definitely worked when I first used it but now it definitely doesn't.
So can you provide a screenshot of the value returned in a setvalue step?
There isn't one. The Set Value
isn't executed. It's effectively as if the Case
is never true.
Just place the setvalue outside the select and run the server action. See the value returned there.
Do you mean one of the setvalues among the different cases? If returns what it is set to return.
I have replaced Select...Case with Condition, one for each value, and the setvalue items return exactly what they're supposed to return.
To clarify, this works:
But this does NOT work:
And I'm now on rc1 with same result.
I can't recreate this. Just tested it in a server action on Wappler 7 RC1
This is the logic:
This is the result:
There must be something wrong with your server action or the values returned. So please check this or test in a new server action.
Thanks @Teodor . It's a strange one. I had used Select...Case in two different places and they both worked perfectly when I set them up. Both then failed this week (or I spotted they'd failed this week) but I hadn't changed anything.
I will create a new server action and test again and let you know. Looking at your screenshots, at least I know I was using them correctly.