[TIP] FM Pro Case function: do it -easier- in Servoy!

For all ye (ex)Filemaker Pro developers:
I allways liked the case(onething; do something ; else another thing) function in Filemaker.

You can do it 2 ways in Servoy:

  • Switch statement (which I find a bit to much of code sometimes)
  • or this way, which looks a lot like the case function itself:
var result = (onething == 'something') ? onething : another thing

You can also check if a field has values in it:

var result = (onething) ? onething : another thing

Pretty neat, huh? :)

Pretty neat!!
One drawback though. It won’t make the code more readable.

That’s a standard programmatic construct called a ternary operator ;)