Simple Mapping (sub-transformation)

As you build a transformation, you may notice a sequence of steps you want to repeat. This sequence can be turned into a mapping.

Like the Mapping step, you can use the Simple Mapping (sub-transformation) step to run a reusable sub-transformation.

Compared to the Mapping step, Simple Mapping (sub-transformation) accepts one input and one output, so it behaves like other steps that read and write rows.

Before you begin

In your sub-transformation, define input and output using these placeholder steps:

The mapping executed by the parent transformation through the Simple Mapping (sub-transformation) step is known as the sub-transformation.

You can run Simple Mapping (sub-transformation) in multiple copies, clusters, single-threading mode, and other execution models.

You can also use this step in advanced data routing scenarios (for example, Filter Rows and Switch / Case) and in partitioned or clustered transformations.

Step name and transformation

Field
Description

Step name

Specifies the unique name of the step on the canvas. A step can be placed on the canvas several times; however, it represents the same step multiple times. Default: Simple Mapping (sub-transformation).

Transformation

Specify your mapping sub-transformation to execute. Select Browse to locate the transformation in the VFS browser. If you select a transformation that has the same root path as the current transformation, the variable ${Internal.Entry.Current.Directory} is inserted automatically in place of the common root path. For example, if the current transformation path is /home/admin/transformation.ktr and you select a transformation in the folder /home/admin/path/sub.ktr, then the path is converted automatically to ${Internal.Entry.Current.Directory}/path/sub.ktr. If you are working with a repository, specify the name of the transformation. If you are not working with a repository, specify the XML file name of the transformation. Transformations previously specified by reference are converted automatically to use the transformation name within the Pentaho Repository.

Options

The Simple Mapping (sub-transformation) step includes the following tabs:

  • Parameters

  • Input

  • Output

Parameters tab

Parameters tab in Simple Mapping (sub-transformation)

Use the Parameters tab to define or pass Kettle variables to the sub-transformation.

Option
Description

Variable name

Variable name to pass to the sub-transformation.

String value (can include variable expressions)

Value to assign to the variable name. You can include variable expressions.

Inherit all variables from the parent transformation

Makes all variables available in the parent transformation available in the sub-transformation, even if they are not explicitly listed in the Parameters tab.

circle-info

If Inherit all variables from the parent transformation is not selected, only the variables listed in the Parameters tab are passed to the sub-transformation.

Input tab

Input tab in Simple Mapping (sub-transformation)

Use this tab to map fields from the incoming stream to the fields in the Mapping Input Specification step inside the sub-transformation.

Option
Description

Fieldname from source step

Name of a field in the incoming stream.

Fieldname to mapping input step

Name of the field as it is used inside the sub-transformation.

Mapping

Opens a dialog listing available fields in both the parent transformation and the sub-transformation so you can map fields.

Update mapped fieldnames downstream

Renames fields back to their original names when they reach the Mapping Output Specification step. This can make sub-transformations more transparent and reusable.

Add inputs to the table

  1. Select Mapping.

  2. Select a Source Field.

  3. Select a Target Field.

  4. Select Add.

  5. To remove a mapping, select Delete.

  6. Select OK.

Output tab

Output tab in Simple Mapping (sub-transformation)

Use this tab to map fields from the Mapping Output Specification step inside the sub-transformation to the output stream of the Simple Mapping (sub-transformation) step.

Option
Description

Fieldname from mapping step

Field name as it is available in the Mapping Output Specification step inside the sub-transformation.

Fieldname to target step

Field name to use in the outgoing stream of the Simple Mapping (sub-transformation) step.

Get Fields

Populates the grid with all output fields from the sub-transformation.

Logging

To differentiate log lines from a mapping, edit kettle.properties and set KETTLE_LOG_MARK_MAPPINGS to Y.

When KETTLE_LOG_MARK_MAPPINGS is set to Y, PDI precedes log lines with the step name and mapping name.

See also

Last updated

Was this helpful?