Data Load Wizard - Transformation Script
 

This step allows you to define a script which is applied to every row in the file. The script uses the BeanShell scripting language. The script allows you to perform customized mappings, transformations and validations on the incoming data.


Special BeanShell Commands

Accessing Row Data

Object row.get(String name)

Returns the value of the current row in the column with the specified name.

row.set(String name, Object value)

Sets the value of the current row in the column with the specified name to the specified value.

Logging and Error Handling

dataload.info(String message)

Writes an info message to the log file.

dataload.warning(String message)

Writes a warning message to the log file.

dataload.error(String message)

Writes an error message to the log file and rejects the row.

Validation

boolean isEmpty(Object value)

Returns true if the specified value is null, an empty string, a string containing only whitespace characters or a collection or array without elements.

Transformation

String capitalize(String value)

Returns a string there the first character of the given value is changed to upper case.

Example: capitalize("text") will return "Text"

String combine(String pattern, Object[] values)

Combines the given values according to the given pattern using java.text.Messageformat.

Example: combine("{0}-{1}", new String[]{"abc", "def"}) will return "abc-def"

String decapitalize(String value)

Returns a string there the first character of the given value is changed to lower case.

Example: decapitalize("TEXT") will return "tEXT"

String fillLeft(String text, String filler, int length)

Returns a string there the filler is prepended to the given text until it has reached the given length.

Example: fillLeft("text", ".", 10) will return "......text"

String fillRight(String text, String filler, int length)

Returns a string there the filler is appended to the given text until it has reached the given length.

Example: fillRight("text", ".", 10) will return "text......"

String[] match(String value, String pattern)

Tries to match the given value string to the given pattern string. If the string matches the method will return an array containing the capturing groups else it will return null.

Example: match("abc:123", "(.*):(\d*)") will return {"abc:123", "abc", "123"}