Expression syntax

The Following Functions, Operators and Constants are defined and useable in expression strings.

Note

All names are case-sensitive

Constants

Constants are special values of mathematical or scientific significance.

Name

Value

pi

Pi (π\pi)

e

Euler’s number (e\mathrm{e})

Inf

Infinity (\infty)

NaN

Not a Number

Operators

Operators are a special function mapped to a symbol, that will appear between the operands rather than as a name followed by a comma separated list of operands.

Operators have a precedence which indicates the priority with which they are applied i.e. low precedence valued operators will be evaluated before higher valued ones.

Note

Values of the same precedence are evaluated left to right

Symbol

Operation

Syntax

Precedence

Display

+

Added A to B

A + B

3

(A+B)\left(A + B\right)

-

Subtract B from A

A - B

3

(AB)\left(A - B\right)

*

Mutlipy A by B

A * B

2

(A×B)\left(A \times B\right)

/

Divide A by B

A / B

2

AB\frac{A}{B}

%

Reminder of A Divided by B

A % B

2

(AmodB)\left(A \bmod B\right)

^

Raise A to the B’th power

A ^ B

1

ABA^{B}

&

Logical AND of A and B

A & B

4

(AB)\left(A \land B\right)

|

Logical OR of A and B

A | B

4

(AB)\left(A \lor B\right)

<\>

Logical XOR of A and B

A <> B

4

(AB)\left(A \oplus B\right)

!

Logical NOT of A

!A

UNARY

¬A\neg A

==

Test if A is equal to B

A == B

5

(A=B)\left(A = B\right)

~

Test if A is similar to B

A ~ B

5

(AB)\left(A \sim B\right) [1]

!=

Test if A isn’t equal to B

A != B

5

(AB)\left(A \neq B\right)

!~

Test if A isn’t similar to B

A !~ B

5

(AB)\left(A \nsim B\right) [1]

<

Test if A is less than to B

A < B

5

(A<B)\left(A < B\right)

>

Test if A is more than to B

A > B

5

(A>B)\left(A > B\right)

<=

Test if A is less than or equal to B

A < B

5

(AB)\left(A \leq B\right)

>=

Test if A is more than or equal to B

A > B

5

(AB)\left(A \geq B\right)

<~

Test if A is less than or similar to B

A < B

5

(AB)\left(A \lesssim B\right) [1]

>~

Test if A is more than or similar to B

A > B

5

(AB)\left(A \gtrsim B\right) [1]

Functions

These as normal functions a name followed by a list of parameters

Name

Operation

Syntax

Display

abs

Absolute value of A

abs(A)

A\left|A\right|

sin

Sine value of A

sin(A)

sin(A)\sin\left(A\right)

cos

Cosine value of A

cos(A)

cos(A)\cos\left(A\right)

tan

Tangent value of A

tan(A)

tan(A)\tan\left(A\right)

re

Real component of A

re(A)

(A)\Re\left(A\right)

im

Imagery component of A

im(A)

(A)\Im\left(A\right)

sqrt

Square root of A

sqrt(A)

A\sqrt{A}

loc

Gets specific value from array

loc(A, idx)

loc(A,idx)loc\left(A, idx\right)

last

Last value in array

last(A)

last(A)last\left(A\right)

first

First value in array

first(A)

first(A)first\left(A\right)

rloc

Sub-array of array

rloc(A, start, end)

rloc(A,start,end)rloc\left(A, start, end\right)

cumsum

cumulative sum

cumsum(A)

cumsum(A)cumsum\left(A\right)

is_last

True if value is last in array

is_last(A)

is_last(A)is\_last\left(A\right)

is_loc

True if value at specified location

is_loc(A, idx)

is_loc(A,idx)is\_loc\left(A, idx\right)

rank

SQL RANK function

rank(A)

rank(A)rank\left(A\right)

dense_rank

SQL DENSE_RANK function

dense_rank(A)

dense_rank(A)dense\_rank\left(A\right)

date

Date of datetime

date(A)

date(A)date\left(A\right)

year

Year of datetime

year(A)

year(A)year\left(A\right)

month

Month of datetime

month(A)

month(A)month\left(A\right)

weekday

Weekday of datetime

weekday(A)

weekday(A)weekday\left(A\right)

dayofyear

Day of year of datetime

dayofyear(A)

dayofyear(A)dayofyear\left(A\right)

day

Day of datetime

day(A)

day(A)day\left(A\right)

hour

Hour of datetime

hour(A)

hour(A)hour\left(A\right)

minute

Minute of datetime

minute(A)

minute(A)minute\left(A\right)

second

Second of datetime

second(A)

second(A)second\left(A\right)

microsecond

Microsecond of datetime

microsecond(A)

microsecond(A)microsecond\left(A\right)

days

Days of timedelta

days(A)

days(A)days\left(A\right)

hours

Hours of timedelta

hours(A)

hours(A)hours\left(A\right)

minutes

Minutes of timedelta

minutes(A)

minutes(A)minutes\left(A\right)

seconds

Seconds of timedelta

seconds(A)

seconds(A)seconds\left(A\right)

now

Current datetime

now(A)

now(A)now\left(A\right)

if

SQL IF function

if(Condition,A,B)

if(Condition,A,B)if\left(Condition,A,B\right)

case

SQL CASE function

case(cond_1,A,cond_2,B,C)

case(cond1,A,cond2,B,C)case\left(cond_1,A,cond_2,B,C\right)

coalesce

SQL COALESCE function

coalesce(A,B)

coalesce(A,B)coalesce\left(A,B\right)

maximum

Max value within array

maximum(A)

maximum(A)maximum\left(A\right)

minimum

Min value within array

minimum(A)

minimum(A)minimum\left(A\right)

as_dt

Transform value or array to datetime

as_dt(A)

as_dt(A)as\_dt\left(A\right)

as_td

Transform value or array to timedelta

as_td(A)

as_td(A)as\_td\left(A\right)

as_int

Transform value or array to int

as_int(A)

as_int(A)as\_int\left(A\right)

as_float

Transform value or array to float

as_float(A)

as_float(A)as\_float\left(A\right)

Examples

The Following are some example expressions demonstrating the Precedence order and display formatting

sin(x*(y+z))
sin((x * (y + z)))
sin((x×(y+z)))\sin\left(\left(x \times \left(y + z\right)\right)\right)
(a+b)/(c+d)
((a + b) / (c + d))
(a+b)(c+d)\frac{\left(a + b\right)}{\left(c + d\right)}
a+b/c+d*e^f
((a + (b / c)) + (d * (e ^ f)))
((a+bc)+(d×ef))\left(\left(a + \frac{b}{c}\right) + \left(d \times e^{f}\right)\right)
a^b/c^d
((a ^ b) / (c ^ d))
abcd\frac{a^{b}}{c^{d}}
a*b/c*d
(((a * b) / c) * d)
((a×b)c×d)\left(\frac{\left(a \times b\right)}{c} \times d\right)
a*b/(c*d)
((a * b) / (c * d))
(a×b)(c×d)\frac{\left(a \times b\right)}{\left(c \times d\right)}