Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I still experience troubles using tJavaFlex component. Using a main flow as an input, sometimes everything runs smoothly but there are cases when the tJavaFlex only gets null values in all fields. I managed to find a workaround by using a tFlowToIterate component to transcode the main flow in an iterate flow, but I would like to understand what is happening here.
Any explanation on any of these topics would be greatly appreciated.
Thanks !
for the tJavaflex i think it's because you use the for clause in the begining and not in the loop, the beginning is launched at first and then it loop for each iteration of the main row in the main part of the tJavaflex.Thats why it's working with tflowtoiterate.
Hi, why are you using tJavaFlex ?
Could you send screens of the tJavaFlex ?
and also screens of the tFixedFlowinput.
Send me Love and Kudos
flow to iterate will execute the rest of the subjob after the iterate link for one iteration of the main flow, so if you have 3 rows in the main flow it will execute the rest 3 times (one for each row of the main flow). It can also stock in globalVar the value of the fields of one row. So you can reuse them at each moment of the iteration.
Hello Jeremy, and thanks for your interest.
I typically use a tJavaFlex when I need to "insert" lines in a flow. This can happen in various cases.
In the toy exemple above I have a flow with three String fields (N, P, T). The last field contains a coma separated list of tokens and I want a new line for each token : (N, P, S) where N an P are simply repeated and S contains the token extracted from T.
So, a stream composed of these two lines :
[("x", "y", "0"), ("a" ,"b" , "1,2,3")]
Would result in 4 lines :
[("x","y","0"), ("a","b","1"), ("a","b","2"), ("a","b","3")]
The code seems straightforward, tell me if I misunderstood something.
ok just use the tNormalize component , you don't have to use a tJavaflex for this.
tAggegateRow -->main-->tNormalize-->main -->the rest of the job
Send me Love and Kudos
Makes perfect sense. Thanks.
Actually, everythink became clear when my last component in the subjob was a file writer. With an iterate, unless I specifically ask for an appending behaviour, the file is overwritten at each iteration.
Thanks for pointing out the tNormalize, I actually didn't know that component.
That being said in my today's job, while I need to "normalizie" a column I also need to mute others. Let's say each line contains shopping informations such as the id of the buyer, total shopping price and the coma separated list of purchased items. Even though I don't have the detailed price for each item I need to render a line per item, but when doing so I would like to keep the other fields only on the first line and mute them for the remainig lines.
("bob", "10$", "cake,tea")
-->
("bob", "10$", "cake")
(, , "tea")
tJavaFlex still seems a natural way to perform that.
Furtermore, last time I used a tJavaFlex I had to deal with something a bit more tricky where a part of the job was about storing manager related information in a HashMap, and the other part of the job was about running through this HashMap to extract and list this "per-manager" information. To date I still can't see any other way to do that than using a tJavaFlex.
All that aside, do you have any idea if an explanation to why tJavaFlex would read null values from a main flow ? I can provide a toy example if needed.
for the tJavaflex i think it's because you use the for clause in the begining and not in the loop, the beginning is launched at first and then it loop for each iteration of the main row in the main part of the tJavaflex.Thats why it's working with tflowtoiterate.
you could use tnormalize to separate the values then add an order number with a sequence by exemple and then set to null each values for N and P if order is different to 1.