Functions

Functions are used in expressions to make calculations. Functions have 0 or more parameters that must be number or text and return a text.

There are a number of predefined functions, but you can also define your own with the instruction function.

Mathematical functions

name example result
abs(number) abs(-4) 4
ceil(number) ceil(3.6) 4
cos(number) cos(3.14/4) 0.7073883
exp(number) exp(2) 7.389056
floor(number) floor(3.6) 3
ln(number) ln(7.389056) 2
log(number) log(7.389056) 0.868589
max(number,number) max(3,5) 5.000000
min(number,number) min(3,5) 3.000000
pow(number,number) pow(2,3) 8
rnd() rnd() 0.7126855
round(number) round(3.6) 4
sign(number) sign(-4) -1
sin(number) sin(3.14/6) 0.4997701
sqrt(number) sqrt(2) 1.414214
tan(number) tan(3.14/6) 0.5769964

Text functions

name example result
format(number,spec) format(9.55,"%1.1f") 9.5
length(text) length("FooBar") 6
lower(text) lower("FooBar") foobar
pad(text,number) pad("FooBar",16) FooBar
regexreplace(text,pattern,newtext) regexreplace("FooBar","o+","U") FUBar
replace(text,oldtext,newtext) replace("FooBar","o","a") FaaBar
trim(text) trim(" FooBar ") FooBar
upper(text) upper("FooBar") FOOBAR
urltext(text) urltext("Foo Bar") foo-bar

Date functions

name example result
secondstosql(number) secondstosql(1000000000) 2001-09-09 03:46:40
sqltoseconds(text) sqltoseconds("2000-01-01") 946681200

Other

name example result
rownumber rownumber 5 (rownumber is not a function, but a constant, no paranthesis)