Code Filters¶
Code filters apply flexible JavaScript transformations to the resultset after it has been created.
The code editor displays a text area where custom JavaScript code can be entered in the form of the body of a method with the following signature:
"use strict";
function transform(params) {
return params.value
}
where params
is a data structure in the form:
{
value: <cell value>
}
the purpose of the code is to transform params.value
and return the replacement value. The default no-op implementation is return params.value
which will
return the cell value without any modifications.
Care should be take to handle empty values since null values are possible.
Example: Convert column values to upper case¶
Code sample
return params.value ? params.value.toUpperCase() : null;
Example: Add a default value¶
Code sample
return params.value ? params.value.toUpperCase() : "Default value";