SWITCH CASE

By Claudio Felipe Sampaio on 14 Dec 2012
As the IF function, there should be a function SWITCH CASE like a function, otherwise I need to use several nested IF one of my tasks.
Kilian Hekhuis17 Dec 2012
I'm not sure what would accomplish this. If-functions are typically used in one-liners, and in practice, you'll hardly need to nest more than one or two. For more complex logic, you use the switch tool thingy (what are they called anyway?). I'm guessing you're thinking a bit too much 3GL-style programming instead of the OutSystems Way™.
Rebecca Hall17 Dec 2012
You can create a function where you pass in your values and then use the built in switch statement to determine the return value.
J.17 Dec 2012
I agree with Kilian and Rebecca.

If you "need" a switch-statement inside an expression, I really should reconsider the code.
Some other related ideas for this one:

Screen:
1015
1139

Expression editor:
1189

In mine opion, I would like to have both (-:
Good morning Evert van der Zalm!
 
Really, if I had the two options mentioned, it would be great and would help a lot.
You be really nice!

Im getting tired of using chainned IF's statements inside a expression to consider all cases.

Merged from 'Switch case inside expression wizard' (idea created on 2012-07-18 15:13:19 by Luis Paulo Soares), on 2014-01-24 12:35:58 by Gonçalo Borrêga
J.20 Jul 2012
Imho, if an expression contains more than 1-2 inline if's I should be thinking of a better solution.


on the other hand, if the inline-if could have the else-branche as optional it would improve the readability!


Merged from 'Switch case inside expression wizard' (idea created on 2012-07-18 15:13:19 by Luis Paulo Soares), on 2014-01-24 12:35:58 by Gonçalo Borrêga