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

Share business templates, ideas, experiences, etc with fellow Servoy developers here

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

Postby Karel Broer » Mon Oct 23, 2006 9:17 pm

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:

Code: Select all
var result = (onething == 'something') ? onething : another thing


You can also check if a field has values in it:
Code: Select all
var result = (onething) ? onething : another thing


Pretty neat, huh? :)
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Postby ROCLASI » Mon Oct 23, 2006 9:45 pm

Pretty neat!!
One drawback though. It won't make the code more readable.
Robert Ivens
ROCLASI Software Solutions / JBS Group, Partner
SAN Developer / Servoy Valued Professional / Servoy Certified Developer
Twitter: @roclasi / @servoyforge
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5230
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby cybersack » Mon Oct 23, 2006 10:05 pm

That's a standard programmatic construct called a ternary operator ;)
User avatar
cybersack
 
Posts: 302
Joined: Sun Jan 02, 2005 1:17 am


Return to Sharing Central

Who is online

Users browsing this forum: No registered users and 1 guest

cron