User Tools

Site Tools


syntax:functions:when

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
syntax:functions:when [2016/06/08 00:19] – created dmitrysyntax:functions:when [2021/08/28 21:17] (current) – [See also] craigt
Line 1: Line 1:
-====== when(condition, expression) ======+====== When(condition, expression) ====== 
 +Category:  Logical function
  
-Returns the result of //expression// if //condition// is true. Otherwise returns [[syntax:types|empty value]]. This function is effectively a shorthand for '' if(condition, expression, empty()) ''+\\  
 +=====Description===== 
 +This function returns the result of //expression// if //condition// is TRUE. Otherwise, it returns [[syntax:types|empty value]].
  
-^  Example   Result  +This function is effectively a shorthand version of  '' if(condition, expression, empty()) '' 
-| when( 2 + 2 = 4, 'Makes sense' Makes sense  | + 
-when( 1 + 1 = 4, 'Makes sense'  |+ 
 +\\  
 +=====Arguments===== 
 +^Argument^Type^Description
 +|condition|Expression|This is an expression or "test" that evaluates to either TRUE or FALSE.| 
 +|expression|Expression|Any expression.| 
 + 
 +**Return value type:** Text, Number, Boolean (the value type of the returned value from //expression//), or, [[syntax:types|empty value]]. 
 + 
 +\\  
 +=====Examples===== 
 + 
 +  when(2 + 2 = 4, 'Makes sense'//Returns 'Makes sense' 
 + 
 +  when(1 + 1 = 4, 'Makes sense'//Returns empty 
 + 
 +  when([FieldA] = 10, 'FieldA is 10') //Returns 'FieldA is 10' (where [FieldA] is 10) 
 + 
 +  when([FieldA] = 10, 'FieldA is 10') //Returns empty (where [FieldA] is 20) 
 + 
 + 
 +\\  
 +===== See also ===== 
 +  * [[syntax:functions:empty|Empty()]] 
 +  * [[syntax:functions:if|If(condition, when_true, when_false)]]
syntax/functions/when.1465359570.txt.gz · Last modified: 2016/06/08 00:19 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki