User Tools

Site Tools


syntax:functions:when
no way to compare when less than two revisions

Differences

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


Previous revision
Last revision
syntax:functions:when [2021/08/28 21:14] craigt
Line 1: Line 1:
 +====== When(condition, expression) ======
 +Category:  Logical function
  
 +\\ 
 +=====Description=====
 +This function returns the result of //expression// if //condition// is TRUE. Otherwise, it returns [[syntax:types|empty value]].
 +
 +This function is effectively a shorthand version of  '' if(condition, expression, empty()) ''
 +
 +
 +\\ 
 +=====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:if|If(condition, when_true, when_false)]]
syntax/functions/when.txt · Last modified: 2021/08/28 21:17 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki