Script expressions
Expressions can be used in both the LOAD statement and the SELECT statement. The syntax and functions described here apply to the LOAD statement, and not to the SELECT statement, since the latter is interpreted by the ODBC driver and not by QlikView. However, most ODBC drivers are often capable of interpreting a number of the functions described below.
Expressions consist of functions, fields and operators, combined in a syntax.
All expressions in a QlikView script return a number and/or a string, whichever is appropriate. Logical functions and operators return 0 for False and -1 for True. Number to string conversions and vice versa are implicit. Logical operators and functions interpret 0 as False and all else as True.
The general syntax for an expression is:
expression ::= ( constant | fieldref | operator1 expression | expression operator2 expression | function | (expression ) )
where:
constant is a string (a text, a date or a time) enclosed by single straight quotation marks, or a number. Constants are written with no thousands separator and with a decimal point as decimal separator.
fieldref is a field name of the loaded table.
operator1 is a unary operator (working on one expression, the one to the right).
operator2 is a binary operator (working on two expressions, one on each side).
function ::= functionname( parameters)
parameters ::= expression { , expression }
The number and types of parameters is not arbitrary. It depends on the function used.
Expressions and functions can thus be nested freely, and as long as the expression returns an interpretable value, QlikView will not give any error messages.