List of Functions
Below we provide a list of functions available in the expression language. Descriptions and examples are provided as applicable for each.
ConditionalReturn
Synonyms: ConditionalAssignment | ConditionalReturn | ReturnIf | Select
Examples
ConditionalReturn("4 > 3", "Yes", "No") - returns Yes args[0] = boolean or string condition args[1] = return value if true args[2] = return value if false
Case
Synonyms: Case | Map | MapValue | Switch
Examples
Case("test", {"test": 2, "other": 3}, 0) - returns 2 args[0] = key to map (can be of type number, string, or boolean) args[1] = obj (key-value pairs) args[2] = default value (returned if no keys match) Note: args[0] is compared to the keys of args[1] using the type of args[0] so that, for example, args[0] = 9.000000 compared to key "9" will resolve to true.
StringLength
Synonyms: StringLength
Examples
StringLength("test") - returns 4 args[0] = string
StringRepeat
Synonyms: StringRepeat
Examples
StringRepeat("AB", 2) - returns ABAB args[0] = string args[1] = integer
ToUpperCase
Synonyms: ToUpperCase
Examples
ToUpperCase("test") - returns TEST args[0] = string
ToLowerCase
Synonyms: ToLowerCase
Examples
ToLowerCase("TEST") - returns test args[0] = string
StringEquals
Synonyms: StringEquals
Examples
StringEquals("compareMe", "string1", "compareMe", ...) - returns true args[0] = string args[1] = check if equal to string args[2] = check if equal to string ... check all further arguments ... Returns true if args[0] matches any other args[n]
RegexMatch
Synonyms: RegexMatch
Examples
RegexMatch("[0-9]+", "12345ABC", 0) - returns 12345 args[0] = regex args[1] = subject string args[2] = starting offset
RegexTest
Synonyms: RegexTest
Examples
RegexTest("[0-9]+", "12345ABC", 0) - returns true (because it maches) args[0] = regex args[1] = subject string args[2] = starting offset
RegexSearch
Synonyms: RegexSearch
Examples
RegexSearch("[0-9]+", "ABC12345DEF", 0) - returns 3 (index of start of match) args[0] = regex args[1] = subject string args[2] = starting offset
RegexReplaceAll
Synonyms: RegexReplaceAll
Examples
RegexReplaceAll("[0-9]+", "ABC12345DEF", "999") - returns ABC999DEF (index of start of match) args[0] = regex args[1] = subject string args[2] = replace with
RegexReplaceAllWithBackReferences
Synonyms: RegexReplaceAllWithBackReferences
Examples
RegexReplaceAllWithBackReferences("[0-9]+", "ABC12345DEF", "999") - returns ABC999DEF (index of start of match) args[0] = regex args[1] = subject string args[2] = replace with
Add
Synonyms: Add | Sum
Examples
Add(1,2,3,4,5) - returns 15
Multiply
Synonyms: Mult | Multiply | Prod | Product
Examples
Multiply(1,2,3,4,5) - returns 120
Rand
Synonyms: Rand
Examples
Rand(0,3) - returns a random number between 0 and 3 args[0] = lower limit (inclusive) args[1] = upper limit (exclusive)
Subtract
Synonyms: Sub | Subtract
Examples
Subtract(5,3) - returns 2 args[0] = number to subtract from args[1] = number to subtract
Divide
Synonyms: Div | Divide
Examples
Divide(6,3) - returns 2 args[0] = number to divide args[1] = number to divide by
Remainder
Synonyms: Mod | Modulo | Modulus | Rem | Remainder
Examples
Remainder(5,4) - returns 1 args[0] = number to divide args[1] = number to divide by
Quotient
Synonyms: Quo | Quotient
Examples
Quotient(5,4) - returns 1 args[0] = number to divide args[1] = number to divide by
Power
Synonyms: Pow | Power | PowerOfX
Examples
Power(2,3) - returns 8 args[0] = number to raise to a power args[1] = power to raise by
TimesPowerOfTwo
Synonyms: ScaleByPowerOf2 | ScaleByPowerOfTwo | TimesPowerOf2 | TimesPowerOfTwo
Examples
TimesPowerOfTwo(6,3) - returns 48 (6 * 2^3) args[0] = number to multiply by args[1] = power of two
IntegerInRange
Synonyms: IntegerInRange | IntInRange
Examples
IntegerInRange(0, 2, 3, false, false) - returns true args[0] = min args[1] = compare value args[2] = max args[3] = exclude lower limit (defaults to false) args[4] = exclude upper limit (defaults to false)
IntegerInRange
Synonyms: DBLInRange | DoubleInRange | InRange
Examples
IntegerInRange(0, 2, 2.5, false, false) - returns true args[0] = min args[1] = compare value args[2] = max args[3] = exclude lower limit (defaults to false) args[4] = exclude upper limit (defaults to false)
IntegerInRange
Synonyms: IntegerCoerceIntoRange
Examples
IntegerInRange(0, 3, 2, false, false) - returns 2 args[0] = min args[1] = compare value args[2] = max args[3] = exclude lower limit (defaults to false) args[4] = exclude upper limit (defaults to false)
DoubleInRange
Synonyms: DoubleCoerceIntoRange
Examples
DoubleInRange(0, 3, 2.5, false, false) - returns 2.5 args[0] = min args[1] = compare value args[2] = max args[3] = exclude lower limit (defaults to false) args[4] = exclude upper limit (defaults to false)
PowerOf10
Synonyms: Pow10 | Power10 | PowerOf10
Examples
PowerOf10(3) - returns 1000 args[0] = power of ten to compute
Increment
Synonyms: Inc | Increment | Plus1 | PlusOne
Examples
Increment(3) - returns 4 args[0] = number to increment
Decrement
Synonyms: Dec | Decrement | Minus1 | MinusOne
Examples
Decrement(3) - returns 2 args[0] = number to decrement
Sin
Synonyms: Sin | Sine
Examples
Sin(pi()) - returns 0 args[0] = number to compute sine of
Cos
Synonyms: Cos | Cosine
Examples
Cos(pi()) - returns 0 args[0] = number to compute cosine of
Tan
Synonyms: Tan | Tangent
Examples
Tan( (pi()/2) ) - returns 1 args[0] = number to compute tangent of
Sec
Synonyms: Sec | Secant
Examples
Sec(1) - returns 1.85081571768 args[0] = number to compute secant of
Csc
Synonyms: Cosecant | Csc
Examples
Csc(1) - returns 1.18839510578 args[0] = number to compute cosecant of
Cot
Synonyms: Cot | Cotangent
Examples
Cot(1) - returns 1.18839510578 args[0] = number to compute cotangent of
Abs
Synonyms: Abs | Absolute | AbsoluteValue
Examples
Abs(-2) - returns 2 args[0] = number to compute cotangent of
Round
Synonyms: Rnd | Round
Examples
Round(1.2) - returns 1 args[0] = number to round to nearest integer Note: if the value is midway between two integers, returns the nearest even integer
Floor
Synonyms: Floor | RoundDown
Examples
Floor(1.2) - returns 1 args[0] = rounds down to the next lowest integer
RoundToDecimalPlace
Synonyms: RoundToDecimalPlace
Examples
RoundToDecimalPlace(1.6666, 3) - returns 1.667 args[0] = number to round to specified decimal place args[1] = decimal place to round to
RoundToDecimalPlace
Synonyms: TruncateAtDecimalPlace
Examples
RoundToDecimalPlace(1.6666, 3) - returns 1.666 args[0] = number to truncate at specified decimal place args[1] = decimal place to truncate at
Ceil
Synonyms: Ceil | Ceiling | RoundUp
Examples
Ceil(1.2) - returns 2 args[0] = rounds up to the next highest integer
Sqrt
Synonyms: Sqrt | SquareRoot
Examples
Sqrt(4) - returns 2 args[0] = number to take square root of
Square
Synonyms: Square
Examples
Square(4) - returns 16 args[0] = number to square
Reciprocal
Synonyms: Reciprocal | Reciprocate
Examples
Reciprocal(4) - returns 0.25 args[0] = number to reciprocate
Log
Synonyms: Log | Log10
Examples
Log(1) - returns 0 args[0] = number to compute log of (base 10)
ln
Synonyms: Ln | Log2
Examples
ln(1) - returns 0 args[0] = number to compute natural log of (base e)
GenerateArray
Synonyms: GenerateArray
Examples
GenerateArray(0, 0.1, 5) - returns [0, 0.1, 0.2, 0.3, 0.4] args[0] = Initial Value args[1] = Increment args[2] = Size
InArray
Synonyms: InArray
Examples
InArray(0, [0,1,2]) - returns true args[0] = search for element args[1] = search in array
ArraysIntersect
Synonyms: ArraysIntersect
Examples
ArraysIntersect([1,2,3], [0,1,2]) - returns true args[0] = array 1 args[1] = array 2
ArraySize
Synonyms: ArraySize
Examples
ArraySize([1,2,3]) - returns 3 args[0] = array
ArrayAND
Synonyms: ArrayAND
Examples
ArrayAND([true, false, true]) - returns false args[0] = array
ArrayOR
Synonyms: ArrayOR
Examples
ArrayOR([true, false, true]) - returns true args[0] = array
ArrayIndex
Synonyms: ArrayIndex
Examples
ArrayIndex([1,2,3], 1) - returns 2 args[0] = array args[1] = index of desired value
ArrayAppend
Synonyms: ArrayAppend
Examples
ArrayAppend([1,2,3], 4) - returns [1,2,3,4] args[0] = array args[1] = value to append
ArrayDeleteElement
Synonyms: ArrayDeleteElement
Examples
ArrayDeleteElement([1,2,3], 1) - returns [1,3] args[0] = array args[1] = index of value to delete
ArrayAppend
Synonyms: ArrayReplaceElement
Examples
ArrayAppend([1,2,3], 0, 4) - returns [4,2,3] args[0] = array args[1] = value to append
ArrayInsertElement
Synonyms: ArrayInsertElement
Examples
ArrayInsertElement([1,2,3], 0, 4) - returns [4,1,2,3] args[0] = array args[1] = index to insert at args[2] = value to insert
ArrayEqual
Synonyms: ArrayEqual
Examples
ArrayEqual([1,2,3],[1,2,3], false) - returns true args[0] = array 1 args[1] = array 2 args[2] = whether to ignore order (defaults to false)
ObjectJoin
Synonyms: JSONJoin | JSONMerge | ObjectJoin | ObjectMerge
Examples
ObjectJoin("Upsert", {"test": 1}, {"other": 2}) - returns {"test": 1, "other": 2} args[0] = json obj args[1] = json obj args[2] = merge mode
JSONEqual
Synonyms: JSONEqual | ObjectEqual
Examples
JSONEqual({"test": 1}, {"test": 1}, "", "") - returns true args[0] = json obj 1 args[1] = json obj 2 args[2] = path in json obj 1 (optional) args[3] = path in json obj 2 (optional)
GetDateTime
Synonyms: GetDateTime
Examples
GetDateTime("%Y") - returns 2018 GetDateTime("SecondsSinceEpoch") - returns 3758086820.751585 for February 1, 2023 around 3am central time args[0] = format (string) args[1] = if args[0] is a format string, then this is interpreted as a boolean where true means use UTC format. If args[0] is the string "SecondsSinceEpoch" then this is interpreted as a number indicating the number of digits of precision to use in the return value. Note that 'epoch time' here refers to the number of seconds elapsed since 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]
Wait
Synonyms: Wait
Examples
Wait(2000) - returns value of the millisecond timer args[0] = number to milliseconds to wait
GetTickCount
Synonyms: GetTickCount
Examples
GetTickCount(2000) - returns value of the millisecond timer args[0] = unit of time to return (Milliseconds | Seconds | Minutes | Hours | Days; defaults to Milliseconds)
GetDiskFreeSpace
Synonyms: GetDiskFreeSpace
Examples
GetDiskFreeSpace("C:") - returns the free space on the specified disk args[0] = a string representing the disk name to check for free space
isNull
Synonyms: isNull
Examples
isNull(null) - returns true args[0] = value to test if null
isBoolean
Synonyms: isBoolean
Examples
isBoolean(true) - returns true args[0] = value to test if boolean
isNumber
Synonyms: isNumber
Examples
isNumber(10.7) - returns true args[0] = value to test if number
isNumber
Synonyms: isArray
Examples
isNumber([1,2,3]) - returns true args[0] = value to test if array
isNumber
Synonyms: isObject
Examples
isNumber({"a": 1}) - returns true args[0] = value to test if object
ZeroPad
Synonyms: ZeroPad
Examples
ZeroPad(1.23, 5, "Right") - returns 1.230 args[0] = value args[1] = total width args[2] = left or right (defaults to padding on the left)
EvaluateStringToBoolean
Synonyms: EvaluateStringToBoolean
Examples
EvaluateStringToBoolean("some wild thing") - returns false args[0] = "any string" Note: 0. quotes are optional (though to be a function, what's passed in must be a json type, so string wrapping with quotes will treat the general case) 1. true, !0, !F, !false, and !null will evaluate to true 2. everything else evaluates to false
ToDBL
Synonyms: ToDBL | ToDouble
Examples
ToDBL("2.3") - returns 2.30000000000000000 args[0] = value
ToI64
Synonyms: ToI64
Examples
ToI64("2.3") - returns 2 args[0] = value
ToU64
Synonyms: ToU64
Examples
ToU64("2.3") - returns 2 args[0] = value
ToI32
Synonyms: ToI32 | ToInt
Examples
ToI32("2.3") - returns 2 args[0] = value
ToU32
Synonyms: ToU32 | ToUInt
Examples
ToU32("2.3") - returns 2 args[0] = value
ToI16
Synonyms: ToI16
Examples
ToI16("2.3") - returns 2 args[0] = value
ToU16
Synonyms: ToU16
Examples
ToU16("2.3") - returns 2 args[0] = value
ToI8
Synonyms: ToI8
Examples
ToI8("2.3") - returns 2 args[0] = value
ToU8
Synonyms: ToU8
Examples
ToU8("2.3") - returns 2 args[0] = value
ThermocoupleVoltageToCelcius
Synonyms: TCVoltageToCelcius | ThermocoupleVoltageToCelcius
Examples
ThermocoupleVoltageToCelcius(2.3, "B") - returns 42.5683 args[0] = value
CelciusToKelvin
Synonyms: CelciusToKelvin
Examples
CelciusToKelvin(10) - returns 283.15 args[0] = value
KelvinToCelcius
Synonyms: KelvinToCelcius
Examples
KelvinToCelcius(10) - returns -263.15 args[0] = value
KelvinToFarenheit
Synonyms: KelvinToFarenheit
Examples
KelvinToFarenheit(10) - returns -441.67 args[0] = value
CelciusToFarenheit
Synonyms: CelciusToFarenheit
Examples
CelciusToFarenheit(-40) - returns -40 args[0] = value
FarenheitToCelcius
Synonyms: FarenheitToCelcius
Examples
FarenheitToCelcius(-40) - returns -40 args[0] = value
FarenheitToKelvin
Synonyms: FarenheitToKelvin
Examples
FarenheitToKelvin(-40) - returns 233.15 args[0] = value
U64UpperBytesAsU32
Synonyms: U64UpperBytesAsU32
Examples
U64UpperBytesAsU32(10000000000) - returns 2 args[0] = value
U64LowerBytesAsU32
Synonyms: U64LowerBytesAsU32
Examples
U64LowerBytesAsU32(10000000000) - returns 1410065408 args[0] = value
I64UpperBytesAsU32
Synonyms: I64UpperBytesAsU32
Examples
I64UpperBytesAsU32(10000000000) - returns 4294967293 args[0] = value
I64LowerBytesAsU32
Synonyms: I64LowerBytesAsU32
Examples
I64LowerBytesAsU32(10000000000) - returns 2884901888 args[0] = value
U32UpperBytesAsU16
Synonyms: U32UpperBytesAsU16
Examples
U32UpperBytesAsU16(100000) - returns 1 args[0] = value
U32LowerBytesAsU16
Synonyms: U32LowerBytesAsU16
Examples
U32LowerBytesAsU16(100000) - returns 34464 args[0] = value
I32UpperBytesAsU16
Synonyms: I32UpperBytesAsU16
Examples
I32UpperBytesAsU16(-100000) - returns 65534 args[0] = value
U32LowerBytesAsU16
Synonyms: I32LowerBytesAsU16
Examples
U32LowerBytesAsU16(-100000) - returns 31072 args[0] = value
U16UpperBytesAsU8
Synonyms: U16UpperByteAsU8
Examples
U16UpperBytesAsU8(300) - returns 1 args[0] = value
U16LowerBytesAsU8
Synonyms: U16LowerByteAsU8
Examples
U16LowerBytesAsU8(300) - returns 44 args[0] = value
I16UpperBytesAsU8
Synonyms: I16UpperByteAsU8
Examples
I16UpperBytesAsU8(-300) - returns 254 args[0] = value
I16LowerBytesAsU8
Synonyms: I16LowerByteAsU8
Examples
I16LowerBytesAsU8(-300) - returns 212 args[0] = value
CharToByte
Synonyms: CharToByte | CharToU8
Examples
CharToByte(string, index) CharToByte("AB", 0) - returns 65 (since A has underlying byte value 65) CharToByte("AB", 1) - returns 66 (since B has underlying byte value 66) returns the value of the byte corresponding to the character (specified by index) in the supplied string
BytesToString
Synonyms: BytesToString
Examples
BytesToString([byte, byte]) - returns the string corresponding to the byte array BytesToString([65,66]) - returns the string "AB" (without quotes)
HexEncodeString
Synonyms: HexEncodeString
Examples
HexEncodeString("A") - returns the string "41" HexEncodeString("AB") - returns the string "4142"
HexEncodedCharToByte
Synonyms: HexEncodedCharToByte | HexEncodedCharToU8
Examples
HexEncodedCharToByte("41") - returns 65 (i.e. the base 10 value of 0x41)
GetByteAtPosition
Synonyms: GetByteAtPosition
Examples
GetByteAtPosition(5, 0) - returns 5 (00000000 00000101) GetByteAtPosition(5, 1) - returns 0 (00000000 00000101) GetByteAtPosition(256, 0) - returns 0 (00000001 00000000) GetByteAtPosition(256, 1) - returns 1 (00000001 00000000)
StringToBytewiseXORHexString
Synonyms: StringToBytewiseXORHexString
Examples
StringToBytewiseXORHexString("CSTLT,+0996.83,+0001.94,-0057.47,+093.300,+000.112,+028.0") - returns 5B
Pi
Synonyms: Pi
Examples
Pi() - returns the value of pi (3.1415....)
e
Synonyms: e
Examples
e() - returns the value of pi (2.71828....)
SpeedOfLight
Synonyms: SpeedOfLight
Examples
SpeedOfLight() - returns the value of the speed of light in meters per second (299792458 m/s)
GravitationalConstant
Synonyms: G | GravitationalConstant
Examples
GravitationalConstant() or G() - returns the value of the gravitational constant (6.6742E-11)
AvogadrosNumber
Synonyms: Avogadro | AvogadrosNumber
Examples
AvogadrosNumber() or Avogadro() - returns Avogadros Number (6.0221415E+23)
p
Synonyms: p | Planck
Examples
p() or Planck() - returns Planck's constant (6.6260693E-34)
ElectronCharge
Synonyms: ElectronCharge
Examples
ElectronCharge() - returns the charge of an electron (1.60217653E-19)
Rydberg
Synonyms: Rydberg
Examples
Rydberg() - returns Rydberg's constant (10973731.56853)
MolarGasConstant
Synonyms: MolarGasConstant
Examples
MolarGasConstant() - returns the Molar Gas constant (8.314472)