As NextStep 2012 says 'Simplicity'.
A switch widget on a webscreen will make the web screens more simple to understand!
Just as we have the IF statement we can use when building the frontends, it would be great to have a switch statement so we could, for example, show/hide several elements according to a boolean expression. The workaround is enclosed ifs, which makes the interface difficult to view and manage,
A switch would be functionally and visually just about no different from Ifs right after each other. Also, don't nest Ifs if you don't like it, just put them right after each other with a blank "false".
J.Ja
@Justin, true, but the situation gets tricky when you have about 10 Ifs with a lot of visual elements. This starts getting extremely difficult to manage (visually). With the switch, we would be able to show only one or all of the branches. This would make it easier to jump to a specific branch straight away.
Paulo -
Ah, yeah, that makes sense! I rarely use the "show true" or "show false" on the If so I forget that this is a feature. :)
The idea is to have a new or modification to the existing Switch widget such that the switch widget can be bound to static entity identifier variable. Once bound, the switch widget will automatically create all the condition statements based on the elements in the static entity type.
As it happens in the logic side, sometimes we require something in the webblock/screen to be rendered conditionally, but there are times in which that condition is not only True or False
For those cases we typically chain If's within If's, but it would be nice to have the Case version available
The default (by dragging and dropping it in the canvas) would (as it happens on the logic counterpart) have the Condition 1 and the Otherwise parts available, and would grow as conditions are added.
A visual representation could look like this (pardon my paint skills)
The switch is really useful to use in preparations or actions, however you can't use it on a screen. This would be useful for when you have multiple display conditions on many items on a screen.
Perhaps there is a reason for this not existing that I haven't realised?
Looking forward for this widget! I wanted to provide the same idea, because I need it quite often in my application's screens.
Currently the Screen editor has an If widget that allows you to display other widgets (images, text, etc) based on a given condition.
This has resulted in nested if statements for every page that shows a loading and has a "no items to display"
Following the Case widget of the 'Flowchart' sections of the Client Actions and Server Actions - Add a case screen widget that behaves similar to the If screen widget which displays the first True result.
It would be very efficient to have some form of a "Switch Widget" similar to the If widget.
I often find that I have to create nested if statements for widgets. It would be great if there was a switch which can be used to display a UI component should it satisfy one of the branches, or just revert to a default.
It might look something like this in the widget tree.
Yes please!
Why didn't I come up with this idea?
I think it is great improvement for readability.
It's a simple yet a great idea.
+ 1
My vote for this. great idea
+1 this idea.
Simple, yet effective!
Great idea!
The same way we have Switch statements for logic flows, there could be a switch 'widget', where you can have any number of conditions and elements displayed according to the first one that evaluates truth, along with an 'Otherwise'
Example:
A table shows a list of orders, and at the end, an coloured icon for their status. There could be 6 statuses, and all of them have a different icon.
Right now, the way to do this is with a bunch of If statements, one right next to the other, which in display it can look a bit messy at times:
With something like a switch:
The little circles where you choose to display or hide the elements would hide all of them (maybe with exception of the first one?). With the Ifs there's no way of doing that and sometimes it gets clunky. There would be many applications for this.
I think this is a good idea
Cool idea, would make working with complex conditional UI's much easier.