# Sample transformation walkthrough using the Lookup field

The following example transformation demonstrates how to use the **Lookup** field. The transformation processes a CSV file and feeds its data into the Avro Input step. The Avro Input step decodes the Avro structure using a lookup field consisting of an **atm\_id** variable mapped to an *atm* field.

1. Save the following code block in a text file as `atm.schema`.

   ```
   {
     "type": "map",
           "values":{
           "type": "record",
           "name":"ATM",
           "fields": [
                     {"name": "serial_no", "type": "string"},
                     {"name": "location", "type": "string"}
           ]
           }
   }
   ```
2. Save the following code block in a text file as `simpleexample.csv`:

   ```
   atm|atms
   atm1|{"atm1": {"serial_no": "zxy555", "location": "Uptown"}, "atm2": {"serial_no": "vvv242", "location": "Downtown"}, "atm4": {"serial_no": "zzz111", "location": "Central"}, "atm6": {"serial_no": "piu786", "location": "Eastside"}, "atm10": {"serial_no": "hbc999", "location": "Westside"}, "atm20": {"serial_no": "mmm456", "location": "Lunar city"}}
   atm2|{"atm1": {"serial_no": "zxy555", "location": "Uptown"}, "atm2": {"serial_no": "vvv242", "location": "Downtown"}, "atm4": {"serial_no": "zzz111", "location": "Central"}, "atm6": {"serial_no": "piu786", "location": "Eastside"}, "atm10": {"serial_no": "hbc999", "location": "Westside"}, "atm20": {"serial_no": "mmm456", "location": "Lunar city"}}
   atm4|{"atm1": {"serial_no": "zxy555", "location": "Uptown"}, "atm2": {"serial_no": "vvv242", "location": "Downtown"}, "atm4": {"serial_no": "zzz111", "location": "Central"}, "atm6": {"serial_no": "piu786", "location": "Eastside"}, "atm10": {"serial_no": "hbc999", "location": "Westside"}, "atm20": {"serial_no": "mmm456", "location": "Lunar city"}}
   ```
3. Create a transformation with a CSV File Input step and a hop from the CSV Input step to the Avro Input step.

   ![Avro Input Sample CSV Transform](/files/e7FDbbMEpkRKzqrqEm1Y)
4. Configure the CSV File Input step as shown below, where the file name is the path to the `simpleexample.csv` file on your system:

   ![Avro Input Sample CSV File Input](/files/BCM3w8YvVSUfyJiDnnrI)

   **Note:** Make sure that the delimiter is the pipe character.
5. Configure the Avro File Input step tabs as shown below, where the schema is the path to the `atm.schema` file on your system:

   ![Avro Input Sample Source Config](/files/DNjXEYqb2hT3X3ZjuTRO)
6. Click **Get fields** to populate the **Avro fields** table. Enter the **Indexed values**field as shown below:

   ![Avro Input Sample Avro Fields Config](/files/n9FgNpPFEiIxsHsWdVP5)

   **Note:** Make sure to select the **Pass through fields from previous step** option.
7. Enter the following values in the **Lookup fields** tab:

   ![Avro Input Sample Lookup Fields Config](/files/UQPL6AJoMxYleQ5U5kIy)
8. Click **Preview** to view the data.

   You should see results similar to the results shown below:

   ![Avro Input Sample Preview Data](/files/Xl9MioQwcmQ3uJKd6cPo)
9. Save your transformation.


---

# 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/avro-input/options-reuse/lookup-fields-tab-reuse/sample-transformation-walkthrough-using-the-lookup-field-avro-input-kettle.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.
