Skip to main content

Pentaho+ documentation has moved!

The new product documentation portal is here. Check it out now at docs.hitachivantara.com

 

Hitachi Vantara Lumada and Pentaho Documentation

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 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 changes it to hierarchical data and sends it to other steps. See Hierarchical data for an overview of hierarchical data in Pentaho.

General

 
  • Step name: Specifies 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 group rows step window
Field Description
Field name Specifies the field name that will be used to group the incoming data.
Pass Through? Select to add the specified incoming field to the output fields.

In the Target hierarchical field, you can specify a new field name to be added into output or select an incoming hierarchical field name to modify.

NoteIf the target field is an existing field, it must be included as one of the grouping fields.

Modifications

 
Field Description
Hierarchical path Specifies the path that has to be modified or created inside the target hierarchical field. See Hierarchical data path specifications
Action Specify the action to perform on the Target field name. The modification actions you can perform with this step are:
  • SET – Sets the Target hierarchical path in the Target field name to the value specified in the Value field name field.
  • SET_IGNORE_NULL_VALUE - Performs the SET Modify action if the value field is not null.
  • SET_IF_NULL - Sets the Target hierarchical path to the value specified in the Value field name field if the target hierarchical path of the HDT is null.
  • UNSET - Unsets the Target hierarchical path in the Target HDT (before: { hello: null, hello2: 10 }, after: {} )
  • UNSET_IF_NULL - Unsets the Target hierarchical path if the value stored at the path is null (before: { hello: null, hello2: 10 }, after: { hello2: 10} )
Value field name Specifies the field for performing the previous 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. The use of this step is also demonstrated in the Advanced_Using_Multiples_To Join_And_Edit.ktr transformation. Comments in the transformation explain how the steps are used.

Modify values from group rows example ktr