Switch Case/Else-If Function in Server Connect

Hello ,

I needed a switch case function in my project. Alternatively, I am using the “if” condition. There is no issue. But can the switch case function be included in server connect?

What exactly are you trying to achieve?

I have to make a calculation with multiple options.
therefore I will have to use a lot of if conditions. I thought it would be better to use the switch case.

There is no switch case available in Server Connect. Just use conditions :slight_smile:

Yes maybe it could be a good idea to add. :slight_smile:

My app is getting more complicated by the hour so I see myself in need of this also. A “Switch Case” feature in SC and AP flows would help a lot with maintenance.
Voted.

5 Likes

I’m now also in need of using Switch Case instead of a heavily nested IF statement in a flow… will try and use a custom JS script for now

1 Like

I also need it a lot

1 Like

I was able to get it working nicely today writing a custom script and using dmx.app.set to get the data available in Wappler. It was a good learning experience and got the result I needed. Would be easier if it was native in Wappler, but I got it done at least.

3 Likes

That’s the best thing about Wappler and why I don’t get frustrated by roadmap and timelines. You can always find a way to build it as there are very few limitations. Although I am yet to find one.

Congrats on getting your hands messy!

2 Likes

Indeed. I think this is my 4th or 5th custom script for this project. Soon it will be on to integrating TensoflowJS.

2 Likes

While they’re requests for different features, the request for Elseif usage is nevertheless closely related to the current request and I think the votes should be considered together. Hopefully they can be implemented together - for both Server Connect and for App Connect flows.

I think the lack of these options will become increasingly problematic and limiting as Wappler becomes more powerful and people want to develop more elaborate solutions with it.

1 Like

Agreed. I think they should be merged and title should be changed. Both requests are solutions to the same problem.

If implemented, both features should probably be built at the same time so that branching statements logic is fully covered and integrated well in SC.

1 Like

There is a “switch case” usage feature request that was previously opened. but I guess it is not important enough. However, while server-side operations in the wappler interface, if conditions can sometimes be complicated. I suggested switch case to remove this complexity in using the interface, but if this is not possible, the use of “elseif” would be appropriate.

Of course, this is a decision you will make, but this is not a new feature but an improvement of an existing feature. Using nested "if condition " with the GUI is not really easy. in some cases it causes confusion. The best solution is to use “switch case” , but if it is not possible to add it, it will be better for us to use “elseif” as desired.

I have been using a nested ternary operator to do this.
"arrTotalQty.items.sum() > 499 ? 30 : arrTotalQty.items.sum() > 299 ? 25 : arrTotalQty.items.sum() > 19 ? 15 : 10"

hi @ben
feature request for server-side usage.

Thanks Serhat.

1 Like

Voted this also as a complementary feature for the condition action.
Switch Case action would also be very nice.

4 Likes

The two feature requests have been merged :slight_smile:

4 Likes

I have not been able to attend for a long time due to too much workload. but it will be really comfortable to have this feature. Thank you guys

1 Like