Expression Syntax in Dashboard Functions

The following topics describe the syntax you can use when you specify an expression in the following dashboard functions:

  • Evaluate Expression As Double
  • Evaluate Expression As Row
  • Evaluate Expression As String

The syntax for expressions in dashboard functions follows standard Java syntax and includes the operators and functions described in the topics below.

Operators in dashboard function expressions

A dashboard function that contains an expression can use the following operators:

Operator Precedence
unary +   -   !
multiplicative *   /   %
additive +   -
relational <   >   <=   =>
equality ==   !=
logical `&&   

The following operators are not supported:

  • Bitwise NOT, AND, OR, XOR
  • Arithmetic shift

Supported operators may be applied to double type variables. In addition, the relational and equality operators may be applied to string variables, and the addition operator may be used to concatenate strings.

Arithmetic functions in dashboard function expressions

The following arithmetic functions are supported in dashboard function expressions:

  • abs()

    double abs(double a)
    

    Returns the absolute value of a double value.

  • acos()

    double acos(double a)
    

    Returns the arc cosine of an angle, in the range of 0.0 through pi.

  • asin()

    double asin(double a)
    

    Returns the arc sine of an angle, in the range of -pi/2 through pi/2.

  • atan()

    double atan(double a)
    

    Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.

  • atan2()

    double atan2(double y, double x)
    

    Converts rectangular coordinates (x, y) to polar (r, theta).

  • ceil()

    double ceil(double a)
    

    Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.

  • cos()

    double cos(double a)
    

    Returns the trigonometric cosine of an angle.

  • exp()

    double exp(double a)
    

    Returns Euler’s number e raised to the power of a double value.

  • floor()

    double floor(double a)
    

    Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.

  • IEEEremainder()

    double IEEEremainder(double f1, double f2)
    

    Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.

  • log()

    double log(double a)
    

    Returns the natural logarithm (base e) of a double value.

  • max()

    double max(double a, double b)
    

    Returns the greater of two double values.

  • min()

    double min(double a, double b)
    

    Returns the smaller of two double values.

  • pow()

    double pow(double a, double b)
    

    Returns the value of the first argument raised to the power of the second argument.

  • random()

    double random()
    

    Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.

  • rint()

    double rint(double a)
    

    Returns the double value that is closest in value to the argument and is equal to a mathematical integer.

  • round()

    long round(double a)
    

    Returns the closest long value to the argument.

  • sin()

    double sin(double a)
    

    Returns the trigonometric sine of an angle.

  • sqrt()

    double sqrt(double a)
    

    Returns the correctly rounded positive square root of a double value.

  • tan()

    double tan(double a)
    

    Returns the trigonometric tangent of an angle.

  • toDegrees()

    double toDegrees(double angrad)
    

    Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

  • toRadians()

    double toRadians(double angdeg)
    

    Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

String functions in dashboard function expressions

The following string functions can be in expressions in dashboard functions:

  • charAt()

    char charAt(int index)
    

    Returns the char value at the specified index.

  • compareTo()

    int compareTo(String anotherString)
    

    Compares two strings lexicographically.

  • compareToIgnoreCase()

    int compareToIgnoreCase(String str)
    

    Compares two strings lexicographically, ignoring case differences.

  • concat()

    String concat(String value1, String value2)
    

    Returns the concatenation of value1 and value2.

  • condExpr()

    String condExpr(String expression, String value1, String value2)
    

    Evaluated as true or false, returns value1 if true or value2 if false.

  • endsWith()

    boolean endsWith(String suffix)
    

    Tests if this string ends with the specified suffix.

  • equals()

    boolean equals(Object anObject)
    

    Compares this string to the specified object.

  • equalsIgnoreCase()

    boolean equalsIgnoreCase(String anotherString)
    

    Compares this string to another string, ignoring case considerations.

  • indexOf()

    int indexOf(String str, int fromIndex)
    

    Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.

  • lastIndexOf()

    int lastIndexOf(int ch, int fromIndex)
    

    Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.

  • length()

    int length()
    

    Returns the length of this string.

  • replace()

    String replace(char oldChar, char newChar)
    

    Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.

  • startsWith()

    boolean startsWith(String prefix, int toffset)
    

    Tests if this string starts with the specified prefix beginning at a specified index.

  • substring()

    String substring(int beginIndex, int endIndex)
    

    Returns a new string that is a substring of this string.

  • toLowerCase()

    String toLowerCase()
    

    Converts all of the characters in this String to lowercase by using the rules of the default locale.

  • toUpperCase()

    String to UpperCase()
    

    Converts all of the characters in this String to uppercase by using the rules of the default locale.

  • trim()

    String trim()
    

    Returns a copy of the string with leading and trailing whitespace trimmed.