After creating a new CloverETL graph, it is an empty pane. In order to create a non-empty graph, you must fill the empty graph with components and other graph elements. You need to select graph components, set up their properties (attributes), connect these components by edges, select data files and/or database tables that should be read or unloaded from, written or loaded to, create metadata describing data, assign them to edges, create database connections or JMS connections, create lookup tables and/or create sequences and parameters. Once all of it is done, you can run the graph.
If you want to know what edges, metadata, connections, lookup tables, sequences or parameters are, see Part V, Graph Elements, Structures and Tools for information.
Now we will present you a simple example of how CloverETL transformation graphs can be created using CloverETL Designer. We will try to make the explanation as clear as possible.
First, you need to select components from the Palette of Components.
To select any component, click the triangle on the upper right corner of the Graph Editor pane. The Palette of Components will open. Select the components you want by clicking and then drag-and-dropping them to the Graph Editor pane.
For our demonstration purposes, select UniversalDataReader from the Readers category of the Palette. Select also the ExtSort component from the Transformers category and UniversalDataWriter from the Writers category.
Once you have inserted the components to the Graph Editor pane, you need to connect them by edges. Select the Edge tool on the Palette and click the output port of one component and connect it with the input port of another by clicking again. Do the same with all selected components. The newly connected edges are still dashed. Close the Palette by clicking the triangle at its upper right corner. (See Chapter 18, Edges for more information about Edges.)
Now you need to prepare some input file. Move to the
Navigator pane, which is on the left side of
Eclipse window. Right-click the
data-in folder of your project and select
→ .
Once the new window appears, select the name of your input file
in this window. For example, its name can be
input.txt. Click .
The file will open in the Eclipse
window.
Type some data in this file, for example, you can type pairs of
firstname and surname like this: John|Brown. Type
more rows whose form should be similar. Do not forget to create also a
new empty row at the end. The rows (records) will look like
this:
You need to save the file by pressing Ctrl+S.
After that, double-click the first edge from the left and select Create metadata from the menu that appears beside the edge. In the Metadata editor, click the green button. Another (second) field appears. You can click any of the two fields and rename them. By clicking any of them, it turns blue, you can rename it and press . (See Chapter 19, Metadata for more information about creating Metadata.)
After doing that, the names of the two fields will be Firstname and Surname, respectively.
After clicking , metadata is created and assigned to the edge. The edge is solid now.
Now right-click the first edge and select Propagate metadata from the context menu. The second edge also becomes solid.
Now, double-click UniversalDataReader, click the File URL attribute row and click the button that appears in this File URL attribute row.
(You can see UniversalDataReader for more information about UniversalDataReader.)
After that, URL File Dialog will open. Double-click the
data-in folder and double-click the
input.txt file inside this folder. The file name
appears in the right pane.
Then click . The File URL attribute row will look like this:
Click to close the UniversalDataReader editor.
Then, double click UniversalDataWriter.
(You can see UniversalDataWriter for more information about UniversalDataWriter.)
Click the File URL attribute row and click
the button that appears in this File URL
attribute row. After that, URL File Dialog will open. Double-click
data-out folder. Then click
. The File URL attribute
row will look like this:
Click twice the File URL attribute row and
type /output.txt there. The result will be as
follows:
Click to close the UniversalDataWriter editor.
Now you only need to set up the ExtSort component.
(You can see ExtSort for more information about ExtSort.)
Double-click the component and its Sort key attribute row. After that, move the two metadata fields from the left pane (Fields) to the right pane (Key parts). Move Surname first, then move Firstname.
When you click , you will see the Sort key attribute row as follows:
Click to close the ExtSort editor and save the graph by pressing Ctrl+S.
Now right-click in any place of the Graph Editor (outside any component or edge) and select → .
(Ways how graphs can be run are described in Chapter 11, Running CloverETL Graphs.)
Once graph runs successfully, blue circles are displayed on the components and numbers of parsed records can be seen below the edges:
When you expand the data-out folder in the
Navigator pane and open the output file, you can
see the following contents of the file:
You can see that all persons have been sorted alphabetically. Surnames first, firstnames last. This way, you have built and run your first graph.