Defining and using Kettle variables
In PDI, you can define and use variables, just as you do when you code in any computer language. We already defined a couple of variables when we created the kettle.properties
file in Chapter 1, Getting Started with PDI. Now, we will see where and how to use them.
It's simple: any time you see a dollar sign by the side of a textbox, you can use a variable:
Sample textboxes that allow variables
You can reference a variable by enclosing its name in curly braces, preceded by a dollar sign (for example, ${INPUT_FOLDER}
).
Note
A less used notation for a variable is as follows: %%<variable name>%%
(for example, %%INPUT_FOLDER%%
).
Let's go back to the transformation created in the previous section. Instead of a fixed value for the location of the output file, we will use variables. The following describes how to do it:
- Open the transformation (if you had closed it). You can do this from
Main Menu
or fromMain Toolbar
. - Double-click on the
Text file output
step....