Which component use for IF condition?

One Star

Which component use for IF condition?

For example i have MSSQLInput where i do select "Select count(*) from table" then i connect to SetGlobalVar and set variable row1.count.
Now i need do condition.
IF row1.count<100
IF YES IF NO
DO MSSQLInput DO TJavaRow
Community Manager

Re: Which component use for IF condition?

Hi
You can use the runIf connector to fire different subjobs, for example:
tMssqlInput--main--tSetGlobalVar
|
onsujobok
|
tJava---runIf---tMssqlInput--main--tLogRow
---runIf---another subjob
on the first runIf, set the condition as:
row1.count<100
on the second runIf, set the condition as:
!(row1.count<100)
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Which component use for IF condition?

How Talend will tolerate this flow.
SubJob1
IF Condition(Yes) IF Condition(No)
SubJob2 SubJob3
|
|
SubJob4
I mean i want to run SubJob1, then check condition and run SubJob2 or SubJob3.
And after this must run SubJob4 after that.
Because now when i connect SubJob2 to SubJob4 Talend is not allowing connection from SubJob3 to SubJob4. It merges SubJob2 with SubJob4.
Community Manager

Re: Which component use for IF condition?

Hi
Connect subjob1 to subJob4,
subjob1--runif---subjob2
--runIf--sunbjob3
|
onsujobok
|
subjob4
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Which component use for IF condition?

Hi shong,
subjob4 will be started after subjob2/subjob3 completion or all jobs will be started in parallel mode?
Community Manager

Re: Which component use for IF condition?

Hi
Subjob4 will be started after subjob2/subjob3 completion, if you look into the generated code, you will see the subjobs fired by runIf is inside the subjob1.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Which component use for IF condition?

I have create a JOB:
subjob1 -- runif -- subjob2 (Order 1)
| -- runif -- subjob3 (Order 2)
| -- runif -- subjob4 (Order 3)
| -- runif -- subjob5 (Order 4)
| -- runif -- subjob6 (Order 5)
|
onsubjobok
|
subjob7 -- runif -- subjob8 (Order 1)
-- runif -- subjob9 (Order 2)
-- runif -- subjob10 (Order 3)
-- runif -- subjob11 (Order 4)
-- runif -- subjob12 (Order 5)
Talend executes all subjobs in right way except subjobs which have (Order 5). I mean the last executed subjobs are subjob12 and subjob6
not (subjob11 and subjob12).
It can be seen in database results and in TOS. Runif messages "True" firstly occurs on subjob2, subjob3, subjob4, subjob5 and then on subjob8.
Subjob6 is the last where that message occurs.
When i created another subjob14 which has also 5 RunIf this problem also occurs. Then are executed all subjob14 RunIf subjobs and the last subjobs are subjob12 and subjob6.
Then i delete Order 5 and there are left only 4 RunIf everything works fine.
It could be a bug?