JavaScript expression can be data values when manufacture/trim/calculate data or generate chart.
If the script is blank, then return empty string.
It can include any valid elments which Nashorn can parse(ECMAScript 5.1).
It should be a value finally.
It can include following placeholders:
#{TableRowNumber}
#{DataRowNumber}
#{<column_name>}
#{<column_name>- <statistic-name>}
All valid placeholders are listed in left.
To save the script, click “Edit” button.
Hover or click button “Examples” to paste example codes.
Hover or click button “Histories” to paste codes in histories.
When MyBox evaluates the expression:
Placeholders are replaced with actual values of each data row.
Statistic values are calculated by all data.
‘#{xxx}’ is handled as string while #{xxx} is handled as number.
When handles all pages, script fails when it includes “#{TableRowNumber}” .
row expression | meaning |
---|---|
#{DataRowNumber} % 2 == 0 | data row number is even |
#{TableRowNumber} % 2 == 1 | odd rows in current page |
Math.abs(#{v1}) + Math.PI * Math.sqrt(#{v2}) | calculation |
‘#{v1}’.replace(/hello/ig, ‘Hello’) | replace all “hello”(case-insensitive) as “Hello” in column “v1” |
‘#{v1}’.toLowerCase() | lower case of value of column “v1” |
‘#{v1}’.split(‘,’) | split value of column “v1” by comma |
#{v1} - #{v1-Mean} | difference between value of column “v1” and mean of column “v1” |
new Date(‘#{time}’.replace(/-/g,‘/’)).getFullYear() | year of value of column “time” |
“Row Filter” is special “Row Expression”, and can be condition to filter data rows.
It should be boolean value(“true” or “false”) finally.
Can set maximum rows to take.
Can be saved in tree.
row filter | meaning |
---|---|
#{DataRowNumber} % 2 == 0 | data row number is even |
#{TableRowNumber} % 2 == 1 | odd rows in current page |
Math.abs(#{v1}) >= 0 | value of column “v1” is number |
#{v1}) > 0 | value of column “v1” is larger than zero |
#{v1} - #{v2} < 100 | difference between values of “v1” and “v2” is less than 100 |
‘#{v1}’ == '' | value of column “v1” is null or empty |
‘#{v1}’.length > 0 | value of column “v1” is not empty |
‘#{v1}’.search(/Hello/ig) >= 0 | value of column “v1” includes “Hello”(case-insensitive) |
‘#{v1}’.startsWith(‘Hello’) | value of column “v1” starts with “Hello” |
var array = [ ‘A’, ‘B’, ‘C’];array.includes(‘#{v1}’) | value of column “v1” is one of “A”, “B”, “C” |
#{v1} < #{v1-Mean} | value of column “v1” is less than mean of column “v1” |
new Date(‘#{time}’.replace(/-/g,‘/’)).getTime() > new Date(‘2016/05/19 09:23:12’).getTime() | value of column “time” is later than ‘2016/05/19 09:23:12’ |