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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need Help for if - Else in tJavaRow

Hi,
I'am a beginner on Talend and Java language.
I do a job who request on Informix DB with two tMap and one tUnit for generate a Directory of personns. The Job works fine. But i have a problem for reverse column at the end of job in my csv.
in fact : My csv contain : Name - married name - FirstName. I just want : if married name is different of null, the name = married name.
At the end of my job, juste before generate my final csv, i have add between my tUnit and the cvs output file a tJavaRow coponent, who i haved generate the java code correctely
(exemple 0683p000009MA5A.pngutput_row.nom_pat = input_row.nom_pat; (name)
output_row.nma_pat = input_row.nma_pat; (married name)
And i have add this code :
if (input_row.nma_pat != null) {
output_row.nom_pat = input_row.nma_pat;
output_row.nma_pat = "";}
else { output_row.nom_pat = input_row.nom_pat;}
With that, the job runs correctly, when a line contains a married name, i have this married name in the collumn of name, but the others lines who havent married name (male) have a null name. This is my problem. I think my If - Else is not good.
I hope someone could help me !
Thanks before, and sorry for my poor english!
Labels (3)
11 Replies
Anonymous
Not applicable
Author

Hi,
actually, I'm selecting value using simple Oracle query in one of oraclecomponent toracleInput_1 in talend. The possible Output of this  query is 'Y'/'N'.
 I'd like to process further on value of 'Y' and want to raise error on value of 'N'. but the problem is - I don't know how to get value of previous component in Tdie_1 component or in warning component.
I want to Display message and want my Job to stop on value of 'N'. can you pls help me with code.
Anonymous
Not applicable
Author

Can anyone pls help me on this?