> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/modify-values-from-grouped-rows.md).

# Modify values from grouped rows

Use the Modify values from grouped rows step to build complex hierarchical data and group data based on a hierarchical data field by using path definitions on an ordered group of input rows.

This step modifies hierarchical data to form nested JSON key-value pairs. It can also build complex data by nesting arrays, objects, and key-value pairs. The step takes non-hierarchical data and converts it to hierarchical data and sends it to other steps.

For more information, see [Hierarchical data](/pdia-data-integration/extracting-data-into-pdi/hierarchical-data.md).

### Step name

* **Step name**: Specify the unique name of the Modify values from grouped rows step on the canvas. You can customize the name or leave it as the default.

### Grouping fields

![Modify values from grouped rows step window](/files/jK6b25kGUQOWHDzHj8YY)

| Field             | Description                                                      |
| ----------------- | ---------------------------------------------------------------- |
| **Field name**    | Specify the field name to group the incoming data.               |
| **Pass through?** | Select to add the specified incoming field to the output fields. |

In **Target hierarchical**, specify a new field name to add to the output, or select an incoming hierarchical field name to modify.

{% hint style="info" %}
If the target field is an existing field, it must be included as one of the grouping fields.
{% endhint %}

### Modifications

* **Hierarchical path**: Specify the path to modify or create inside the target hierarchical field. See [Hierarchical data path specifications](broken://spaces/YwnJ6Fexn4LZwKRHghPK/pages/ji5ygWJ7r8yORvFw3Rjj).
* **Action**: The action to perform on the target field.
  * **SET**: Set the target hierarchical path to the value specified in **Value field name**.
  * **SET\_IGNORE\_NULL\_VALUE**: Perform **SET** only if the value field is not null.
  * **SET\_IF\_NULL**: Set the target hierarchical path to the value specified in **Value field name** if the target path is null.
  * **UNSET**: Unset the target hierarchical path.
    * Example: `before: { hello: null, hello2: 10 }, after: {}`
  * **UNSET\_IF\_NULL**: Unset the target hierarchical path if the value stored at the path is null.
    * Example: `before: { hello: null, hello2: 10 }, after: { hello2: 10 }`
* **Value field name**: Specify the field to use for the action.

### Example

The sample transformation `Modify_From_Grouped_Rows.ktr` demonstrates the capabilities of this step and is available in the plugin distribution package in the `data-integration/plugins/hierarchical-datatype-plugin/samples/transformations` directory.

This step is also demonstrated in `Advanced_Using_Multiples_To Join_And_Edit.ktr`. Comments in the transformation explain how the steps are used.

![Modify values from grouped rows example KTR](/files/cFeKlMlm8cLeZgQDiaxx)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/modify-values-from-grouped-rows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
