Javascript Formulas

GridMate provides a lightweight javascript syntax to define calculated columns on the browser side. The formulas are calculated when a grid rendered to the end user or a field is updated.

Data Types

Currently the javascript engine supports the following data types as a return value:

  • Text

  • Checkbox

  • Date

  • Number

  • Currency

  • Percent

Note that the data type is also used to customize the display for the user

Operators

Currently the following operators are supported:

  • +:(plus)

  • -:(minus)

  • *:(multiply)

  • /:(divide)

  • %:(Modulus)

  • <:(less than)

  • >::(greater than)

  • <=:(less or equal)

  • >=:(greater or equal)

  • &&:(and)

  • ||:(or)

  • ==:(equal)

  • !=:(not equal)

Functions

Math Functions

  • CEILING(number) : rounds up and returns the smallest integer greater than or equal to a given number.

  • EXP(number) : returns e raised to the power of a number.

  • FLOOR(number) : rounds down and returns the largest integer less than or equal to a given number.

  • LN(number) : returns the natural logarithm (base e) of a number.

  • LOG(number) : returns the base 10 logarithm of a number.

  • MAX(number, number) : returns the largest of the numbers given as input parameters.

  • MIN(number, number) : returns the smallest of the numbers given as input parameters.

  • ROUND(number, num_digits) : returns the value of a number rounded to the nearest integer.

  • SQRT(number) : returns the square root of a number.

Text Functions

  • BEGINS(text, compare_text) : determines if text begins with specific characters.

  • CONCAT(text1, text2) : concats two arguments of text and returns the concatenated text.

  • CONTAINS(text, compare_text) : compares two arguments of text and returns true if the first argument contains the second argument.

  • LEFT(text, num_chars) : returns the specified number of characters from the beginning of a text string.

  • LEN(text) : returns the number of characters in a specified text string.

  • LOWER(text) : converts all letters in the specified text string to lowercase.

  • LPAD(text, padded_length, pad_string) : inserts characters you specify to the left-side of a text string.

  • MID(text, start_num, num_chars) : returns the specified number of characters from the middle of a text string given the starting position.

  • RIGHT(text, num_chars) : returns the specified number of characters from the end of a text string.

  • RPAD(text, padded_length, pad_string) : inserts characters that you specify to the right-side of a text string.

  • SUBSTITUTE(text, old_text, new_text) : substitutes new text for old text in a text string

  • TRIM(text) : removes the spaces and tabs from the beginning and end of a text string.

  • UPPER(text) : converts all letters in the specified text string to uppercase.

Logical Functions

  • ISNULL(expression) : determines if an expression is null.

  • NOT(logical) : returns the inverse of the given expression.

  • OR(logical1, logical2) : determines if expressions are true or false. Returns true if any expression is true.

  • AND(logical1, logical2) : returns a true response if all values are true.

  • IF(logical_test, value_if_true, value_if_false) : determines if expressions are true or false. Returns a given value if true and another value if false.

  • CASE(expression, ​value1, result1, ...) : checks a given expression against a series of values. If the expression is equal to a value, returns the corresponding result.

Last updated