In AskiaScript, the following mathematical operators, symbols and functions are available.
| Operator | Description |
|---|---|
| + |
Use this operator to add the values from two or more questions. For example: ??Q1??+??Q2?? If Q1=5 and Q2=3, the result will be equal to 8. If Q1 = {1;2;5} and Q2={3}, the result will be equal to {1;2;5;3}. You can also use + to concatenate strings of characters, for example: "It is now: "+Hour(Now)+Minute(Now) In this case, using + will not add the value Hour with the Minute; instead, it will merge them as strings, such as: It is now: 1230 |
| - |
Use this operator to subtract the data from two or more questions. For example: ??Q1??-??Q2?? If Q1=5 and Q2=3, the result will be 2. If Q1 = {1;2;5} and Q2={1}, the result will be {2;5}. |
| * |
Use this operator to multiply the values of two or more questions. For example: ??Q1??*1000 If Q1=5, the result will be 5000. |
| / |
Use this operator to divide the data from two or more questions. For example: ??Q1??/1000 If Q1=5000, the result will be 5. |
| = |
Use this operator to test the equality of two statements. |
| > |
Use this operator to test the relative sizes of two statements. |
| <> |
Use this operator to test the inequality of two statements. This is askiascript's equivalent of ≠. |
| >= |
Use this operator to test the relative sizes of two statements. This is askiascript's equivalent of ≥. |
| <= |
Use this operator to test the relative sizes of two statements. This is askiascript's equivalent to: ≤. |
|
. (decimal symbol, as used in 9.99) |
Use the . symbol as a decimal separator. Regardless of the field type, as well as the host system's Regional Options settings, askiavista will only accept "." as a decimal symbol ("," will be refused). For example, in a routing we wish to set a numerical value. We will write: 123.456 |
|
Avg() |
This is AskiaScript's abbreviation for average. Use this function to calculate the numerical average of responses, including DK and NA. For example: Avg(??Q1??) The above expression returns the mean for the question Q1. |
|
Calc(Index) |
Returns the value of the current calculation, as a number. Use index to refer to the index of the calculation (e.g. the second calculation would be 2). However, we recommend that you use the calculation name to refer to the calculation (see below), as the list of active calculations (and hence the index numbers) can change. If a calculation corresponding to index is not found, DK will be returned. |
|
Calc(Name) |
Calc(Name): Returns the value of the current calculation, as a number. Use name to refer to the name of the calculation (e.g. "mean"). If a calculation corresponding to name is not found, DK will be returned. |
| Int() |
Abbreviation for Integer. Calculates the integer value of a numeric value containing decimals. For example: Int(??Q1??) if Q1=3.27 the function will return 3.
Integer((??Postcode??)/1000) if Postcode=20850, the result of the expression will be 20, because Integer(20.850) is 20.
Note: this function truncates decimal values, so Int(2.879) will return 2. |
| Khi2 |
Performs a Khi2 statistical test. You must provide a "degrees of freedom" parameter. |
| Mod |
Abbreviation for modulo. Use this function to calculate a division's modulo, or the remainder of a division operation. For example: ??Q1??Mod??Q2?? If ??Q1??=15, and ??Q2??=2, the function will return 1. |
| Normal |
Performs a statistical significance test based on the normal distribution. For example, if you wanted to use the Z-score to obtain the probability of significance, you could use the following formula: Normal (abs ( {3} ) )* 100 where {3} is the Z-Score calculation. |
| NormalInv |
Performs a statistical significance test, based on the inverse order of the normal distribution. For example, if you wanted to use the probability of significance (p-value) to obtain the Z-score, you could use the following formula: NormalInv (0.9750) will return a Z-score = 1.96 where 0.9750 is the probability of significance. |
| Student |
Performs a student T-test. You must provide a "degrees of freedom" parameter. |
|
Sum() |
Use this function to calculate the sum of a question. For example: Sum(??Q1??) |
|
Val() |
Use this function to transform textual data from an open question to a numerical value. For example: Val(??Q1??) If Q1 contains '012', the expression will return the value 12. Note: If the open question includes alphanumeric characters, the result will be equal to 0. So if Q1 contains 'text 123' then the function will return 0. |