SMART datagrid Expression is being used to display and handle the data in the grid. Although it contains several special operators to handle the value, it has been defined and implemented as simple as possible to be used in big data set.
In particular, since the priority of relational, comparison, logical operator has been integrated into one in the existing language, it must be enclosed in brackets if necessary. Expression text except the value is not case sensitive.
It is used in EditValidation.expression, DynamicStyle.expression, etc.
It displays from a high priority. There is no priority between operators involved in the same group. If you want to give priority by force, you should enclose in brackets. The priority of Set Operator and Comparison Operator is the same.
Operator | Explanation | Example |
---|---|---|
null | JavaScript null. Use is, is not as operand only. | value is null |
empty | Empty value. undefined, null, Empty String. Use is, is not as operand only. | value is empty |
defined | The value not JavaScript undefiend. Use is, is not as operand only. | value is defined |
nan | JavaScript NaN. Use is, is not as operand only. | value is nan |
true, false | JavaScript true, false | value == true |
Operator | Explanation | Example | Result |
---|---|---|---|
str | Convert to String | str 100 | '100' |
num | Convert to Number | num '199' | 199 |
int | Convert to Integer | int '199.9' | int |
date | Convert to Date. Compare to Date.getTime() value when compare the converted two values. | date '2010/11/11' <= local date date('2010-11-11') <= utc date date('2010-11-11T00:00:00+09:00') | It should be the string which can be transferred by JavaScript Date Object Constructor. In particular, in order to run data comparison operation including time value in all browsers equally, you must use ISO standard format including time zone. Please refer to Date.parse function. |
bool | Convert to Boolean | bool '1' | true |
Operator | Explanation | Example | Result |
---|---|---|---|
not, ! | Denial | not true, ! true | false |
- | Negative | -100 | -100 |
+ | Positive | +100 | 100 |
len | String Length | len 'abcd' | 4 |
rand | Random Integer greater than 0 and less than parameter | rand 100 | 15 |
srand | Ascill string of the length specified by parameter | srand 7 | 'xfeDfdG' |
lower | Change the string specified by parameter to lower case string | lower 'AbcdEf' | 'abcdef' |
upper | Change the string specified by parameter to upper case string | upper 'AbcdEf' | 'ABCDEF' |
Operator | Explanation | Example | Result |
---|---|---|---|
* | Multiplication | 11 * 2 | 22 |
/ | Division | 5 / 2 | 2.5 |
div | Integer Division | 5 div 2 | 2 |
% (mod) | Remainder | 5 % 2, 5 mod 2 | 1 |
Operator | Explanation | Example | Result |
---|---|---|---|
+ | Plus | 11 + 2 | 13 |
- | Minus | 5 - 2 | 3 |
Operator | Explanation | Example | Result |
---|---|---|---|
==, !=, <, <=, >, >= | Comparison | true|false | |
is | Comparison | value is null, value is empty, value is defined, value is nan | true|false |
is not | Comparison | value is not null, value is not empty, value is not defined, value is not nan | true|false |
match, not match | Regular expression | value match '[^d.-+]' | true|false |
imatch, not imatch | Regular expression not case sensitive | value match '[^d.-+]' | true|false |
like, not like | Text comparison | value like '%abc%', value not like '%abc', value like 'abc% | true|false |
ilike, not ilike | Text comparison not case sensitive | value ilike '%abc%', value not ilike '%abc', value ilike 'abc% | true|false |
*The priority of Set operators are the same as Comparison operators.
Operator | Explanation | Example | Result |
---|---|---|---|
in, not in | Include | 3 in (1, 2 3), value not in ('a', 'b', 'c') Right operand should be a list of being enclosed in brackets ('(', ')') and items being separated by comma (','). | true|false |
Operator | Explanation | Example | Result |
---|---|---|---|
&& | Logical AND(And) | true && false | false |
|| | Logical OR(Or) | true || false | true |
grid.setColumns([{
fieldName: 'product_id',
styles: [{
expression: "value > 1000",
styles: {
background: "#01ff0000",
...
}
}]
], {
...
}]);
column.setValidations([{
"expression": "value is not empty",
"level": DataLudi.ValidationLevel.ERROR,
"message": strings["CommCodeMsg"]
}]);