更改循环位置时的 tJavaFlex 行为 [英] tJavaFlex behaviour when changing loop position

查看:23
本文介绍了更改循环位置时的 tJavaFlex 行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工作中遇到一些问题,我怀疑是由于对 tJavaFlex 缺乏了解.我在此测试作业中生成 10 行,并在 tJavaFlex 中生成循环:

Having some problems in a job, and I suspect it is due to a lack of understanding of tJavaFlex. I am generating 10 rows in this test job, and am generating loop inside a tJavaFlex:

因此有 10 行进入,并且在 Start 和 End 部分中有一个循环.我期望对于每一行进入,它会产生 10 行相同的输出.而且我会看到每行的迭代次数为 0,1,2,3....9.

So there are 10 rows coming in, and a loop in the Start and End section. I was expecting that for each row coming in, it would generate 10 identical rows coming out. And that I would see iterations 0,1,2,3....9 for each row.

我得到的是这个.在我看来,整个作业运行了 10 次,因此我有 100 个随机值通过 tRowGenerator 流.

What I got was this. This looks to me like the entire job is running 10 times, and so I have 100 random values coming through the flow from the tRowGenerator.

如果我将 for 循环移动到主代码部分,我就会接近我期望的行为.我期待每一行在它进来时重复 10 次,并且 1 行进来产生 10 个输出行.我得到的是这个.

If I move the for loop into the Main Code section, I get close to the behaviour I was expecting. I am expecting each row when it comes in to be repeated 10 times, and for 1 row coming in to produce 10 output rows. What I get is this.

但即使如此,我的 tLogRow 似乎也只为每 10 次迭代生成一行(看看上面的第 9 次迭代后的 tLogRow 输出,为什么不是 10 项?).我原以为每进入一行就会得到 10 行,我会在 tLogRow 中看到这一点.

But even then my tLogRow is only generating one row for each 10 iterations it seems (look at the tLogRow output after iteration 9 above why not 10 items?). I had thought I would be getting 10 rows for each single row coming in and I would see this in the tLogRow.

我需要做的是从传入的字段中获取一个值,进行一些 reg exp 解析并拆分为一个数组,然后为数组中的每个项目在输出流中创建行.即,可以使用 string.split() 方法将进入的 1 行变成 x 行.

What I need to do is take a value from a field coming in, do some reg exp parsing and split into an array, and then for each item in the array create lines in the output flow. i.e. 1 row coming in can be turned into x number of rows coming out using a string.split() method.

有人可以解释上面的行为吗,并就获取一个值的最佳方法提出建议,进行一些 Java 操作,然后生成多行输出?

Can someone explain the behaviour above, and also advise on the best approach to get one value coming in, do some java manipulation and then generate multiple rows coming out?

感谢任何建议.

推荐答案

您不需要创建自己的循环.

You dont need to create your own loop.

通过将 for 循环放在 Start 代码中,您的主代码将由循环和传入的行触发,并且将执行 n*r 次.

By putting the for loop in the Start code, your main code will be triggered by the loop and by incoming rows, and it will be executed n*r times.

包含 tJavaFlex 的子作业的行为在将 tJavaFlex 包含在其起始代码中之前显示该组件,在结束代码中包含之后的组件,但这可能取决于许多条件,例如数据传播和触发器类型.

The behaviour of subjob that contains a tJavaFlex, reveils that component before tJavaFlex is included into its starting code, and the after component is included in the ending code, but that may depend to many conditions like data propagation and trigger type.

开始代码:

System.out.print("tJavaFlex is starting...");
int i = 0;

主要代码:

i++;
System.out.print("tJavaFlex inside Main Code...iteration:"+i);
row8.ITEM_NAME = row7.ITEM_NAME;
row8.ITEM_COUNT = row7.ITEM_COUNT; 

结束代码:

System.out.print("tJavaFlex is ending..."); 
System.out.print(row7.ITEM_NAME);

这篇关于更改循环位置时的 tJavaFlex 行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆