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

Add sequence

Parent article

The Add sequence step adds a sequence to the PDI stream. A sequence is an ever-changing integer value with a specific start and increment value. You can either use a database sequence to determine the value of the sequence, or have it generated by PDI. PDI-generated sequence values are unique when used in the same transformation, and return to the same starting value each time you run the transformation.

The following transformation steps may also be useful when working with sequences:

  • Add value fields changing sequence

    Adds a sequence when the values of a field change. Each time a value of at least one field changes, the added sequence resets to its starting point.

  • Group By

    Builds aggregates by grouping and generates sequential numbers within rows with repeating values.

See the Get ID from Slave Server step if you need a unique ID in a clustered environment.

General

Enter the following information in the Step name and Name of value options:

OptionDescription
Step nameSpecify the unique name of the step on the canvas. Step name is set to Step sequence by default.
Name of valueSpecify the name of the new sequence value to add to the PDI stream. Name of value is set to valuename by default.

Database generated sequence

Add sequence step

The following table contains options for generating a sequence from a database:

OptionDescription
Use DB to generate the sequence?

Select this check box if you want the sequence to be driven by a database sequence.

Use counter to calculate sequence? is automatically selected if this check box is cleared. Use counter to calculate sequence? is set by default.

ConnectionSelect the connection to where your database sequence resides. If you do not have an existing connection, click either New or Wizard. If you need to modify an existing connection, click Edit. See Define data connections for instructions.
Schema name (optional)Specify the schema name of any related table. Click Schemas to select a schema within the database you specified for Connection.
Sequence nameSpecify the name of the database sequence. Click Sequences to select a sequence within the database you specified for Connection.

PDI transformation counter generated sequence

Use a transformation counter to generate the sequence

The following table contains options for generating a sequence from a PDI transformation counter:

OptionDescription
Use counter to calculate sequence?

Select this check box if you want the sequence to be generated by PDI. This option is set by default

Use DB to generate the sequence? is automatically selected if this check box is cleared.

Counter name (optional)Specify the name of the counter if multiple steps in a transformation generate the same value name to avoid unique sequencing across multiple steps.
Start at valueSpecify the value to start the sequence. For example, if Start at value is set to 1, then the sequence will start with 1. If Start at value is set to 0, then the sequence will start with 0.
Increment bySpecify the amount by which the sequence increases or decreases.
Maximum valueSpecify the value to reach before returning the sequence to the Start at value setting.

For example, if you set Start at value to 1, Increment by to 1, and Maximum value to 3, then the resulting sequence will be 1, 2, 3, 1, 2, 3, 1, 2... If you set Start at value to 0, Increment by to -1, and Maximum value to -2, then the resulting sequence will be 0, -1, -2, 0, -1, -2, 0...