# 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](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping.md) 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:

* [Mapping Input Specification](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping-input-specification.md)
* [Mapping Output Specification](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping-output-specification.md)

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** | <p>Specify your mapping sub-transformation to execute. Select <strong>Browse</strong> to locate the transformation in the <a href="/spaces/YwnJ6Fexn4LZwKRHghPK/pages/Cd4iwCkShCtgENgUrG74">VFS browser</a>.<br><br>If you select a transformation that has the same root path as the current transformation, the variable <code>${Internal.Entry.Current.Directory}</code> is inserted automatically in place of the common root path. For example, if the current transformation path is <code>/home/admin/transformation.ktr</code> and you select a transformation in the folder <code>/home/admin/path/sub.ktr</code>, then the path is converted automatically to <code>${Internal.Entry.Current.Directory}/path/sub.ktr</code>.<br><br>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.</p> |

### Options

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

* **Parameters**
* **Input**
* **Output**

#### Parameters tab

![Parameters tab in Simple Mapping (sub-transformation)](/files/Pc0gbdqpgEs2epZp97GV)

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. |

{% hint style="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.
{% endhint %}

#### Input tab

![Input tab in Simple Mapping (sub-transformation)](/files/qtrZ0Uuije35l7K32lha)

Use this tab to map fields from the incoming stream to the fields in the [Mapping Input Specification](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping-input-specification.md) 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)](/files/A3JhLIac2JhF6GoRVeUI)

Use this tab to map fields from the [Mapping Output Specification](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping-output-specification.md) 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

* [Mapping](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping.md)
* [Mapping Input Specification](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping-input-specification.md)
* [Mapping Output Specification](/pdia-data-integration/pdi-transformation-steps-reference-overview/mapping-output-specification.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/simple-mapping-sub-transformation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
