instantOLAP Online documentation 2.2.7 - CASE

CASE

Syntax

<case-expression> := 'CASE(' <Boolean> ',' <Any> { ',' <Boolean> ',' <Any> } ')'

Since

2.2.2

Return-type

The return-type is the super-type of all values.

Description

The CASE-function allows the conditional evaluation of one or more arguments. The CASE-function is very similar to the IIF function but accepts more than one condition.

Beginning with the first argument (which must be a boolean condition), the system evaluates the condition. If the condition returns TRUE, the following argument is evaluated and its result is returned as the result of the CASE function. If it returns FALSE, then the following condition (the third argument) is evaluated and so on.

If any of the evaluated conditions returns NULL then the function returns NULL. If no condition return TRUE or NULL the function also returns NULL.

Because there is no default return-value for this CASE function, you may add TRUE as the last condition, followed by the default value. Then this condition will always be returned if no other condition matches.

Examples

CASE( HASLEVEL( Time, 1 ), 'L1', HASLEVEL( Time, 2 ), 'L2', TRUE, 'Other' )

Returns 'L1' for years, 'L2' for months and 'Other' for any other level of the current time-selection.

CASE( HASLEVEL( Time, 1 ), 'L1', NULL, 'L2' )

Returns 'L1' for years and NULL for any other level of the time selection.

See also

IIF

Using the Web-Frontend
Using the Workbench
Using the Query-Editor
Using the Config-Editor
Query properties
Chart properties
Configuration properties
Expressions
The Type-system
Syntax
Constants
Functions
ABC
ABS
ADD
ALL
ANCESTORS
AND
ATTRIBUTENAMES
ATTRIBUTENV
ATTRIBUTES
AVG
AVGKEY
BEAUTIFY
BELONGSTO
CASE
CEIL
CHILDREN
CLUSTER
COLSPAN
CONCAT
CONTAINS
CONTAINSTEXT
COUNT
COUNTRY
CUBE
DEBUG
DEFAULTTEXT
DEVIATION
DEPTH
DIMENSIONATTRIBUTENAMES
DIMENSIONNAME
DIMENSIONNAMES
DISTINCT
DIV
DLOOKUP
DRILLKEY
DRILLLEVEL
DSORT
ELEMENT_AT
EMPTY
ENDSWITH
EQUAL
ERROR
EVAL
EXISTS
EXP
FACTROOT
FAMILY
FILTER
FILTERKEYS
FIND
FIRST
FLOOR
FOREACH
FORECAST
FPOP
FPUSH
GREATER
GREATER_OR_EQUAL
HASACCESS
HASCHILDREN
HASKEYS
HASLEVEL
HASPOSITION
HASROLES
HASUSER
IIF
IN
INTERSECT
ISCHILDOF
ISNULL
ISPARENTOF
ITERATIONKEY
JOIN
LANGUAGE
LAST
LEAFS
LEFT
LESS
LESS_OR_EQUAL
LEVEL
LEVELNAMES
LEVELOF
LIMIT
LOCALE
LOOKUP
LTRIM
MATCH
MATRIX
MAX
MAXKEY
MAX_X
MAX_Y
MIN
MINKEY
MIN_X
MIN_Y
MOD
MUL
NEIGHBOURS
NEXT
NONFACTROOTS
NONLEAFS
NOT
NOW
OR
PARENT
PEDIGREE
PERCENTILE
POSITIONOF
POW
PRED
PREV
RANGE
REGRESSION
REPLACE
RETURNTYPE
REVERSE
RIGHT
ROUND
ROWNUM
ROWSPAN
RTRIM
SORT
SPLINE
SPLIT
STARTSWITH
STRLEN
SUCC
SUBSTR
SUBSTRINGBEHIND
SUBTOTALS
SUB
SUM
TEXTPOSITION
TIMESTAMP
TODATE
TOINTEGER
TOKEY
TOLOWER
TONUMBER
TOSTRING
TOUPPER
TRIM
TYPE
UNEQUAL
UNIT
UPPERNEXT
UPPERPREV
USER
VARIANCE
WITHOUT
X
XHEADER
Y
YHEADER
YTD
ZERO
Formats
SQL-Expressions