# Samples

The following sample transformations demonstrate the capabilities of the Mapping step. These samples are available in the distribution package and are included at the following location: `design-tools/data-integration/samples/transformations/mapping`

* Mapping: `simple mapping.ktr`: (an example of a sub-transformation)
* Mapping: `use simple mapping.ktr`: (an example of a parent transformation)

Suppose we have a JavaScript step that we want to use multiple times in several transformations. This sample uses a simple concatenation to demonstrate mapping.![Mapping Step Samples JavaScript step](/files/ftr6dVD3lUbw7NCJwAKt)

The two input fields (strings) that the script needs are: **leftValue** and **rightValue**. Define these two strings in the Mapping input step:

![Mapping Samples Mapping Input Specification](/files/6KNIWI3w7L1ZJMmk9vu2)

The calculated value res is a field we want to pass to the parent transformations, so we add a Mapping output step as well.

**Note:** Mapping input and output are placeholders, there is no actual logic in them.

The resulting mapping looks like the following example:

![Mapping Samples Mapping Result](/files/LYdH1VCmoiAOCA87Lgvz)

Now that the mapping is specified, it's ready to be run.

In this example, there are two fields coming into the Mapping step, X=A+B: A and B. A mapping is made between:

* **A** and **leftValue**
* **B** and **rightValue**
* res and X the result field

This mapping is achieved with the **Input** and **Output** tabs of the **Mapping** dialog box, as shown in these sample screens.

![Mapping Samples Input tab](/files/3E7yNxURXPx3tT86ojD6)

In our sample, we only use one input and output mapping. It is possible however to use 0, 1 or more of either input or output mappings in a mapping transformation. That means that we need to be able to specify which input or output we're addressing in the various tabs. That is where the various step name choices come from in the screenshot.

In this sample, we checked the **Main data path** option. The corresponding **Output** tab shows the example's fieldname values in the mapping and target steps.

![Mapping Samples Output tab](/files/OR35CJ6JVVdPpfUWJyPY)


---

# 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/10.2-data-integration/pdi-transformation-steps-reference-overview/mapping/samples.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.
