简体   繁体   English

在 Pentaho Data Integration 中从数据库表中循环通过 ID

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

I am new to PDI and want to achieve looping.我是 PDI 的新手,想要实现循环。 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.我有一个像{store}/admin/orders/{orderID}/metafields.json这样的{store}/admin/orders/{orderID}/metafields.json ,所以我在表中有 orderID,但我想反复更改 URL 中的 orderID。

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.它只返回第一个 orderID,而不返回其余的。

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 TIA

The way you are thinking for loop, is not correct in PDI.您考虑循环的方式在 PDI 中不正确。 I have prepared a solution for you Loop , you can get help from here.我为你准备了一个Loop解决方案,你可以从这里获得帮助。

Please let me know if you need anything else.如果您需要其他任何东西,请告诉我。 Note: you need to run MainJob2.kjb.注意:您需要运行 MainJob2.kjb。

Also, I have uploaded the output log file , after I run this job.此外,在运行此作业后,我已上传输出日志文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM