Any expression can make use of the built in functions. These Attribute functions are used for performing calculations on data in CenterView. The most common uses are:
- populating output stream attributes;
- building filters.
This section introduces some key concepts that are crucial to understanding how these functions work in CenterView. The concepts are should be fairly straightforward for anyone used to using excel, or any type of database. But CenterView is capable of supporting some complex transformations, where needed, and it is important that you are comfortable with these concepts before setting up elaborate function configurations.
Terminology and conventionsIn examples in the following descriptions, function are given as out.calls = ifNull(in.numCalls, 0, 1). In this format, there are three sections of each expression:
- The first part of the example - out.calls - is either the output stream attribute name or an input stream attribute name (for an input filter).
- The middle part of the example - = - is the operator that links the two main parts of the expression. In a filter this can take a number of value, e.g. >, >=, contains. For an output stream attribute function this is always =, that is, that output stream attribute is set to the resulting value of the function on the right hand side.
- The final part of the example - ifNull(in.numCalls, 0, 1) – is the function itself.
Where a function can take, as one of its arguments, a list of values this is expressed in square brackets, e.g.:
function([value1, value2, ...])
See href="#processingLists"> processing lists of values for details of how lists are handled in functions. Such a list is often called a vector. Indexes: always start at 1. Many functions return an index, indicating the position in a list at which a matched value has been found. E.g. see getElement.
Anchor |
---|
| processingLists |
---|
| processingLists |
---|
|
Processing lists of valuesWhere a function can take a list of values as one of its arguments, the argument will often be an attribute of an input stream, or an expression based on an attribute of an input stream. For example: sum(in.value) where in is an alias for an input stream containing the numeric attribute value. When used as part of a merge or aggregate function, for example, the argument in.value will resolve to a list of values - all the values of value associated with a particular key combination.
Data types- float: a floating point number
- integer: an integer
- string: a string
- date: there is no actual date type is CenterView; dates are handled as string, but these must have a particular format, either:
- "yyyymmdd.hhmmss", or
- "yyyymmdd".
Anchor |
---|
| expressionOperators |
---|
| expressionOperators |
---|
|
Expression operatorsThe following relational operators are available:
- ! (not; reverses the value of a logical expression)
- && (and; can also use the attribute function and)
- || (or; can also use the attribute function or)
- < (greater than; can also use the attribute function gt)
- > (less that; can also use the attribute function lt)
- != (not equals; can also use the attribute function ne)
- == (equals; can also use the attribute function eq)
- >= (greater than or equal to; can also use the attribute function ge)
- <= (less than or equal to; can also use the attribute function le)
The following arithmetic operators are available:
- + (add; can also use the attribute function sum)
- - (minus; can also use the attribute function sum, reversing the sign of the second operand)
- / (divide)
- * (multiply)
The attribute functions are categorised below for easy searching.