pentahopentaho-spoonpentaho-data-integrationpentaho-cde

Looping througt ID's from database table in Pentaho Data Integration


I am new to PDI and want to achieve looping. So the scenario goes like this...

I have a URL like {store}/admin/orders/{orderID}/metafields.json, So I have orderIDs in the table but I want to iteratively change the orderID in the URL.

For Example:

**OrderID** [1,2,3,.....n]

{store}/admin/orders/**1**/metafields.json

{store}/admin/orders/**2**/metafields.json

{store}/admin/orders/**3**/metafields.json
.

.

.

.

{store}/admin/orders/**n**/metafields.json

I tried to do it via variables but no success. It only returns the 1st orderID, not the rest.

The current setup is

 **Transformation 1** ---> **table input** (orderIDs) --> **setVariables** (setting orderID as variable)

**Transforamtion 2** ---> **getVariables** (orderIDs) --> **textoutput** (for testing)

**job 1** ---> **start** -->  **Transformation 1** (with **execute for every input row** option checked) --> **Transformation 2** --> **success**

any alternative will be highly appreciated. TIA


Solution

  • The way you are thinking for loop, is not correct in PDI. I have prepared a solution for you Loop, you can get help from here.

    Please let me know if you need anything else. Note: you need to run MainJob2.kjb.

    Also, I have uploaded the output log file , after I run this job.