You can create an external Groovy script that extends the transform function library, and then call the function in a custom transformation. This provides an extension point to the set of default Groovy-based transformation functions provided with BDD.
The custom Groovy script you create must be packaged in a JAR that you make available as a plug-in to both Studio and the Data Processing component. Next, you can run your custom transformation script in Studio with the runExternalPlugin function.
def pluginExec(Object[] args) { String input = args[0] //args[0] is the input field from the BDD Transformation Editor //Return a lowercase version of the input. input.toLowerCase() }
The script defines the pluginExec() method, which takes an Object array (named args) as an argument. args[0] corresponds to the string attribute to be transformed and is assigned to the input variable. Next, the Transform function toLowerCase() is called to change the input data to lower case and return it to be stored in a single-assign string attribute.
You can create a more complex transformation script in Groovy, for example, one that imports external Java libraries and uses them in the script. Documentation for the Groovy language is available at: http://www.groovy-lang.org/documentation.html
To extend the transform function library and run the custom transformation script: