Topic complex |
Other functions |
Function |
choice() |
Short |
Choose a value from a list |
Syntax |
Choice(Zahl: INTEGER;Ausdruck1,Ausdruck2,..., AusdruckN): Real/String |
Parameter |
|
Return |
The funtion returns that expression which has the number num. If num is not in the area from 1 to N, the function returns the last expression exprN. Depending on the type of the expression the function returns a string or a numeric type. |
See also: |
|
Description |
The numeric expression num is calculated (results n). Subsequent the n'th expression is calculated and returned as the result of the function. If there is no n'th expression the last expression of the series is calculated.
Example:
Choice(x,"one","two","three") -> "one" for x = 1
-> "two" for x = 2
-> "three" else
Choice(5,"one","two","three") -> "three"
Very useful is this function for expample to evaluate selection fields. Internal selection fields have the value 0 if they are empty, otherwise 1 if the first value is selected, 2 if the second one...
In the following example "sex" is a selection field with the constants "female", "male" and "unknown".
Choice(sex,"Dear Mrs. "+$Name,"Dear Mr. "+$Name,"To Whom It May Concern")
|
Write a comment:
|