You can use the following numeric functions in your fields' display text or in the values of your skip or validation logic. 



FunctionDescriptionExample
number(* arg)Converts its argument to a number.=number("42") returns 42 (which can then be used for numerical calculations)
random()Generates and returns a uniformly distributed random number in the range from 0.0 up to but excluding 1.0.=int((random()*(10 - 2)) + 2) returns a random whole number between 2 and 10 
int(number arg)Converts the argument to an integer (a whole number) by discarding the fractional component.=int(pi()) returns 3 
max(value_1, value_2, ...*)Returns the maximum value of the result of converting each argument to a number.=max($age1, $age2, $age3)
min(value_1, value_2, ...*)Returns the minimum value of the result of converting each argument to a number.=min($age1, $age2, $age3)
round(number arg, number decimals?)Returns the closest number to the given argument, with the specified number of decimal places (if any).=round(pi(), 2) returns 3.14
pow(number value, number power)Returns the result of raising the first argument to the power of the second.see BMI calculation example below
log(number arg)Returns the natural logarithm of the argument.
log10(number arg)Returns the base-ten logarithm of the argument.
abs(number arg)Returns the absolute value of the argument (no sign).
sin(number arg)Returns the sine of the argument, expressed in radians.
cos(number arg)Returns the cosine of the argument, expressed in radians.
tan(number arg)Returns the tangent of the argument, expressed in radians.
asin(number arg)Returns the arc sine of the argument, the result being in the range -π/2 to +π/2 radians.
acos(number arg)Returns the arc cosine of the argument, the result being in the range zero to +π radians.
atan(number arg)Returns the arc tangent of the argument, the result being in the range -π/2 to +π/2 radians.
atan2(number arg)Returns the angle in radians subtended at the origin by the point on a plane with coordinates (x, y) and the positive x-axis, the result being in the range -π to +π.
sqrt(number arg)Returns the non-negative square root of the argument.
exp(number arg)Returns the value of e^x.
exp10(number arg)Returns the value of 10^x.
pi()Returns an approximation to the mathematical constant π.

 


Also see here for more functions and expressions you can use. 





Example


The participant's BMI must be calculated by dividing the participant's weight (in kgs) by the participant's height (in meters squared). 

  • Create a Number field to capture the participant's weight and set the Answer Format to be Decimal.



  • Create a Number field to capture the participant's height and also set the Answer Format to be Decimal.



  • Create an Information field to display the calculated BMI value.
  • Type the expression into the Information field display text as follows, using the pow() function to square the height value:



  • Wrap the expression in the round() function to round the result to two decimal places:



  • This will display on the device as: