The logical functions covered in this section are:
The CHOOSE function returns an item at the specified index from a list of values in Cinchy.
This function isn't currently supported in PostgreSQL deployments of the Cinchy platform.
New function translations are actively being worked on by the development team; please check back at a later time.
You can review the full list of in-progress function translations here.
index
Is an integer expression that represents a 1-based index into the list of the items following it.
If the provided index value has a numeric data type other than int, then the value is implicitly converted to an integer. If the index value exceeds the bounds of the array of values, then CHOOSE returns null.
Returns the data type with the highest precedence from the set of types passed to the function.
CHOOSE acts like an index into an array, where the array is composed of the arguments that follow the index argument. The index argument determines which of the following values will be returned.
Simple CHOOSE example
Simple CHOOSE example based on column
CHOOSE in combination with MONTH
The following example returns the season in which a user was added to Cinchy. The MONTH function is used to return the month value from the column HireDate
.
IFF returns one of two values which is depending on if the Boolean expression evaluates TRUE or FALSE in the Cinchy.
This function isn't currently supported in PostgreSQL deployments of the Cinchy platform.
New function translations are actively being worked on by the development team; please check back at a later time.
You can review the full list of in-progress function translations here.
boolean_expression
A valid Boolean expression.
If this argument isn't a Boolean expression, then a syntax error is raised.
true_value
Value to return if boolean_expression evaluates to true.
false_value
Value to return if boolean_expression evaluates to false.
Returns the data type with the highest precedence from the types in true_value
and false_value
.
IIF is a second version of writing a CASE expression. It evaluates the Boolean expression which was passed as the first argument and then returns either TRUE or FALSE based on the result of the evaluation. The true_value is returned if the Boolean expression is TRUE, and the false_value is returned if the Boolean expression is FALSE or unknown.
Return 5 if the condition is TRUE, or 10 if the condition is FALSE: