Search code examples
loopsvariablespentahokettlepentaho-spoon

Pentaho rows to variables


I am trying to create a transformation which takes values from a table input (lets say, 10 rows) and in turns creates variables from the values from the rows. For each row in the original set, I then need to do a new transformation using the variables.

How can I loop through a bunch of rows, one by one, reading it into variables which will be used later in a transformation of its own?


Solution

  • looping in PDI is a bit complicated.

    You can use the following proceed:

    1. Create a job in PDI. First execute a Transformation, which reads or generates the rows you need and use the "Copy rows to result" step.
    2. After that create a execute Job step in the first Job. Here you have to check the "Execute for every input row" Option in the "Advanced" settings of the job. In this job you create and execute the final Transformation, which is transforming your data.
    3. In this transformation you have to use the "get rows from result". Here you can finally read the variables you have defined before.

    Hope i could help you. Best regards.