Case()

 <  Day Day Up  >  

Case()

Category: Logical

Syntax: Case (test1 ; result1 { ; test2 ; result2 ; defaultResult ...})

Parameters: test(n) ”an expression that yields a Boolean result; result(n) ”the value to return if corresponding test is true; defaultResult ”the value to return if all tests are false. Parameters in curly braces {} are optional.

Description: The Case function returns one of several possible results based on a series of tests.

Each test expression is evaluated in order, and when a True expression is found, the value specified in the result for that expression is returned. The function stops evaluating as soon as it finds a True test.

The default result at the end of the parameter list is optional. If none of the tests evaluate to True, the function returns the value specified for defaultResult . If no default result is specified, the Case function returns an "empty" result.

Examples :

 

 Case (IsEmpty (Contact_Name) ; 1) 

Returns 1 if the Contact_Name field is empty. Note that a default value is not required, making the usage of Case() shorter than If() .

 

 Case(Get(SystemLanguage) = "French" ; "Bienvenue";   Get(SystemLanguage) = "Italian" ; "Benvenuto" ;   Get(SystemLanguage) = "German" ; "Willkommen" ;   Get(SystemLanguage) = "Swedish" ; "Vlkommen" ;   Get(SystemLanguage) = "Spanish " ; "Bienvenido", ;   Get(SystemLanguage) = "Dutch" ; "Welkom" ;   Get(SystemLanguage) = "Japanese" ; "Irashaimasu" ;   "Welcome" // default value) 

Returns a welcoming message in the language determined by the Get (SystemLanguage) function.

Comments:

Consider using hard returns in long Case() statements to make them more readable. Note that this example makes repeated calls to Get(SystemLanguage) ; in practice it might be better to use Let() to make a single call to Get(SystemLanguage) so that it needs to be evaluated only once.

 <  Day Day Up  >  


QUE CORPORATION - Using Filemaker pro X
QUE CORPORATION - Using Filemaker pro X
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 494

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net