Runif condition

One Star

Runif condition

Hi,
I need to check the condition after tmap, but the run if connector doesnot exist in tmap.I have tried this using tjavarow component also but i am not able to connect my output aafter checking a condition.
Please refer the details below,
--toracleinput -- tmap ----------- toracleoutput 1
------------toracle output 2
In the above job I have to check a if condition like (if context.value = 1) {proceed with toracleoutput1}
(else){proceed with toracleoutput2}
Please advice on the job sequence flow and the ways to check the condition and return output based on the condition.
Thanks and Regards,
mani.
Seven Stars

Re: Runif condition

You cannot apply a condition directly to a flow. You can either:
1. depending on the difference between your tOracleOutputs, apply the condition directly in the tOracleOutput component's parameters e.g. for Table, have the expression: context.value==1?"TableName1":"TableName2"
2. have two output flows from tMap with your condition as an expression filter on the output tables in tMap
3. link the output flow from tMap to a tHashOutput or tFileDelimitedOutput and then have two RunIfs with your condition from your output component to a corresponding input component and then a flow on to your tOracleOutput e.g.
tMap --flow--> tHashOutput --RunIf(context.value==1)--> tHashInput --flow--> tOracleOutput1
--RunIf(context.value!=1)--> tHashInput --flow--> tOracleOutput2
One Star

Re: Runif condition

Thanks alot for the help.
One Star

Re: Runif condition

Hi,
I want to send email if my tOracleOutput loads data into database, so I connected it with tSendMail(RunIf), but i'm stuck with the code java.
Can you help please ?
One Star

Re: Runif condition

Sure, at the left of talend window when you re in your job, you have outline tab, you select the tOracleOutput that interest you.
After that you drag and drop the value that interest you NB_LINE_INSERTED for exemple and compare to see if it's positive. It should looks like something like :
((Integer)globalMap.get("tOracleOutput_1_NB_LINE_INSERTED"))>0 || ((Integer)globalMap.get("tOracleOutput_1_NB_LINE_Updated"))>0
the || means or.
good luck