CloverETL Overview

For more details and videos take a look at the Quick Start Guide →

 

Designer UI
Anatomy of a Graph
Read & Write Data
Transform & Modify
Merge & Join
Other Actions
Clover Script
Performance

Clover Scripting - CTL

Clover graph components let you crunch your data with speed and power. But there may come a time when you need to perform a little bit of extra wizardry to perform those more intricate data manipulations. Clover CTL scripts can be placed in many of the Clover components. These scripts are then called for each record of data that passes through the component giving you total control of the data transformation process.

Where can I use Clover Scripting?

Components such as ‘Reformat’, ‘Partition’ and the various ‘Joiner’ components have a Transform property. This property allows you to take data entering a component and then map all or certain input fields to output fields.

In most cases, you can simply use the transformation dialog that allows you to map across visually, as shown on the left. The Transformation dialog even lets you apply formulae as you map input fields to output fields.

However, what happens in the background is that Clover Script is automatically generated. The image below shows the script that is generated by the Transform dialog on the left.

How and when is this CTL script executed?

The transformation script is called for each record that Clover processes within the component. Depending on the component where the script resides, a specific function is called. The image on the right shows the function ‘transform()’ that is called by the ‘Reformat’ component as each record is processed. Clover CTL scripting is full featured with

  • for, do-while and while loops
  • if & switch conditionality
  • data typing
  • User-defined and library functions
  • and much more
Simple CTL Script

Give me another example of when I might use a script.

The Partition component examines each record of data and passes it to one of the several output ports based on a set of user-defined conditions.
The Clover CTL script shown on the left receives one record of data at a time. The getOutputPort() function checks the CustomerID field and then sets the return value accordingly. This return value indicates the output port (0, 1 or 2) to which the data record should be routed.