In this article
A list of functions for data type conversion, numeric calculations, filtering, and text manipulation.
| Function | Result type | Comment |
|---|---|---|
| Convert(a, type) | type | The value of a converted to the requested type. See type conversion table. |
| ToInt(a) | Integer | Shortcut for Convert(a,int) |
| ToReal(a) | Real | Shortcut for Convert(a,real) |
| ToText(a) | Text | Shortcut for Convert(a,text) |
| ParseInt(s) | Integer | Parse an input text value and returns an integer value. If the conversion is not possible, returns NULL. It is also applicable to a text list input producing a numeric list result. |
| ParseReal(s) | Real | Parse an input text value and returns a real (floating-point) value. If the conversion is not possible, returns NULL. It is also applicable to a text list input producing a numeric list result. |
| ParseDate(s[, format]) | Date | Parse an input text value and returns a date/time value. If the conversion is not possible, returns NULL. An optional format parameter is a string literal defining the expected date format. The following formats are supported: "ymd" - YYYY-MM-DD [hh:mm:ss]"dmy" - DD-MM-YYYY [hh:mm:ss]"mdy" - MM-DD-YYYY [hh:mm:ss]"default" or missing - same are "ymd"It is also possible to use "/" or "." as date part delimiters |
| IsNull(a1, a2) | Type of a1 | The value of a1 if a1 is not null, otherwise a2. a2 must be convertible to the type of a1 |
| In(a1, a2, ...) | Boolean | Returns true if the value of the first argument is equal to one of the values of a2, etc. The first argument is expected to be an expression of numeric, text or category type. Other arguments are expected to be constants of compatible types. |
| InTop(variable, n) | Boolean | Boolean expression that evaluates to true if the specified single variable has a value among "top n" answers (i.e. answers with the highest scores) |
| InBottom(variable, n) | Boolean | Boolean expression that evaluates to true if the specified single variable has a value among "bottom n" answers (i.e. answers with the lowest scores) |
| InRange(variable, n1, n2) | Boolean | Boolean expression that evaluates to true if the specified single variable has a value in the specified range of scores. n1 and n2 are integer constants specifying lower and upper boundaries of the answer range (1-based) assuming answers are sorted in order of score values from lowest to highest. |
| Between(a1, a2, a3) | Boolean | Equivalent of a1 >= a2 AND a1 <= a3. All arguments must be of (compatible) numeric or date/time type. |
| Power(x1, x2) | Type of x1 | X1 to the power x2 |
| Score(c) | Real | Score of the selected category. It is expected that an argument is a (single) variable with scores assigned to its categories. |
| RangeGapScore(variable,n1,n2) | Real | "variable" is assumed to be a single variable. Evaluates a "score" of every response defined as the following: 1 if the response is in "top n1" answers (promoters)-1 if the response is in "bottom n2" answers (detractors)0 for other answers with scores defined (passives)]null otherwiseRangeGap value is essentially an average of this value. |
| Abs(x) | The type of x | Absolute value of x |
| Ceil(x) | Integer | Minimal integer greater or equal than x |
| Floor(x) | Integer | Maximal integer less or equal than x |
| IIF(b, a1, a2) | Type of a1 | If the condition b is true then a1 else a2. b2 must be convertible to to the type of a1 |
| Ln(x) | Real | Natural logarithm of x |
| Log(x1,x2) | Real | Logarithm of x1 with respect to base x2 |
| Log10(x) | Real | Decimal logarithm of x |
| Exp(x) | Real | Exponent of x |
| Sqrt(x) | Real | Square root of x |
| Round(x, n) | Numeric | Rounded value of x with n decimal places |
| Recode(a, recoding) | Text | Recodes argument value (of numeric, category, text or date/time type) to a text code according to the recoding definition (see below). |
| Multirecode(a, recoding) | Boolean vector | Recodes argument value(of numeric, category, text or date/time type) into a boolean vector according to the recoding definition specified. In contrast with RECODE function ranges/codes in recoding definition can duplicate/overlap. If an argument value matches multiple conditions in recoding definition then corresponding values in the resulting vector will be set to true. |
| Rank(criteria [, partition, partition ...]) | Integer | Evaluates a record rank according to the specified list of (one or more) sorting criteria used to compare data records. Optional partition arguments are expressions defining groups. If partition expressions are specified then ranks are evaluated independently in every group of records with the same combination of values of those expressions. As a special case a simple expression may be specified as a "criteria" argument, in that case the function assumes ascending sorting by the specified expression value. Rank function evaluates a sequence of numbers according to the specified criteria from lower to upper. Records that are considered "equal" according to the criteria will get the same rank value. The rank sequence can contain gaps. |
| RankRev(criteria [, partition, partition ...]) | Integer | Similar to Rank function with sorting order reversed |
| DenseRank(criteria[, partition, partition ...]) | Integer | Evaluates a dense record rank according to the specified list of sorting criterion. Arguments are similar to those of Rank function. In contrast with the Rank function the sequence produced by DenseRank function cannot contain gaps. |
| DenseRankRev(criteria[, partition, partition ...]) | Integer | Similar to DenseRank function with sorting order reversed |
| Demote(a, level) | Type of a | Explicitly moves the value of the first argument to the specified level. Level must be a successor of the level of the argument. |
| KeyFilter(level, a1, a2 ...) | Boolean | A shortcut to create a filter expression for level primary keys. The number of key values (a1, ...) must be the same as the number of level key variables. |
| IsFirst(sourceLevel, targetLevel, sorting) | Boolean | Evaluates to true for every first record from source level related to the same parent record from target level. Each group of records is sorted according to the specified sorting criteria |
| AnswerText(variable) | Text | Returns the text (title) of current answer of a single variable. Currently a default language (request-level option) is used to retrieve texts. |
| FieldMask(v, c1, c2, ...) | Type of v (compound) | First argument is expected to be a compound ("vector") value of any type, other arguments must be text constants. The result is a value of the same type that includes only fields with the specified codes. |