Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tjavarow run if

hi all
i want to do connection between tjavarow to tjavarow only if something is happend how can i do it?
i try to use run if but i can't to connect him to the second tjavarow.. 
in the talend we have something that can help?

Labels (2)
12 Replies
Anonymous
Not applicable
Author

because i want to see the whole flow, i may be able do write everything in " tJavaRow" but then again, what's the
point in using TALEND?
so i can write sql statement in the tJavaRow and do everything in java, what what would be the logic in that?
i'm now exploring the Talend and want to unify\combine\unite 2 Flows into 1, as depicted in the pictures i've attached in previous message.

the goal is as follows, from the beginning:
 i have a row that needed to be processed, and that row is split into 2 flows:
1- first flow      --> will happen only if some condition happens.
2- second flow  --> the same as the 1st flow--> will happen only if another condition happens.

Eventually, for every row (with no regarding to which flow i've entered, for instance, i can enter flow 1 or flow 2 )
i need to perform some more actions, like : log \update DB   etc....
and i don't want to write these actions twice. 
meaning, from 2 flows, i need only 1 output, 1 outcome.

i'd appreciate any help. 
Anonymous
Not applicable
Author

First of all, Talend is just a tool that generates Java. There is no shame in using Java to circumvent a situation where you litter the job with components. However, you can do what you want to do. But you will be sacrificing performance to show the whole flow, you will be bending Talend rules on data flow (you are not supposed to split a flow and rejoin it in a subjob) and you will be loading your job with far too many components. But since Talend is arguably the most flexible DI tool, you can do this. Below is a screenshot of an example I have put together...
 
0683p000009MH7c.png

You have to make use of tFlowToIterates to create global variables from your flow data, you then use dummy tJava components to "terminate" a path before switching to RunIf links to test your global variables. This has to be iterated rather than flowed. You can then "do something" with the data before switching to a tFlowToIterate again, terminating with a tJava and using RunIfs to merge back to a single flow of data. This is done using a tFixedFlowInput. You then can carry on. Rather than explain the full complexity of this in text, I have included the job here  RunningTotal.zip

Alternatively, you can be much more efficient with code, development time and performance and use this in your tJavaRow....

String value = input_row.SomeValue;

if(value.equals("hello")){
    output_row.SomeText = "olleh";
}else if(value.equals("world")){
    output_row.SomeText = "dlrow";
}


By the way, the example was written using Talend v562. You can use with any version the same or greater
Anonymous
Not applicable
Author

ok I try this solution and it work thanks... 🙂