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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Samana
Contributor
Contributor

How to call child job from parent job based on condition mentioned in parent job

Hi,

I have 2 child jobs( child job 1 and child job 2) and 1 parent job. In parent job, I need to give a condition based on which child job 1 or child job 2 or both the child jobs should get executed.

For Example: If value is "Y" in parent job, then child job 1 should get executed. If value is "N" then child job 2 should get executed. Else, both the child jobs should get executed.

Can you let me know how to achieve this?

Thanks

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Define a context variable to store the value, and use RunIf connector to control the child jobs execution..

on tJava--runIf11--tRunJob1

--runIf2--tRunJob2

--runIf3--tRunJob1--oncomponentok--tRunJob2

set the condition of runIf1 as:

context.varName.equals("Y")

set the condition of runIf2 as:

context.varName.equals("N")

set the condition of runIf3 as:

!(context.varName.equals("Y")||context.varName.equals("N"))

on tJava or other components, initialize the value of the context variable or load the value from somewhere.

 

Regards

Shong

View solution in original post

4 Replies
Anonymous
Not applicable

Define a context variable to store the value, and use RunIf connector to control the child jobs execution..

on tJava--runIf11--tRunJob1

--runIf2--tRunJob2

--runIf3--tRunJob1--oncomponentok--tRunJob2

set the condition of runIf1 as:

context.varName.equals("Y")

set the condition of runIf2 as:

context.varName.equals("N")

set the condition of runIf3 as:

!(context.varName.equals("Y")||context.varName.equals("N"))

on tJava or other components, initialize the value of the context variable or load the value from somewhere.

 

Regards

Shong

Samana
Contributor
Contributor
Author

Thanks for the solution

Samana
Contributor
Contributor
Author

Hi @Shicong Hong​ ,

 

I have a situation now where I don't want to create third flow i.e, I don't want to repeat tRunJob1 and tRunJob2 in the third flow as I have already created 2 separate flows for that.

If I give the value as "Y" then first flow should execute. If I give the value as "N" then second flow should execute. And, both the flows should execute in sequence based on some condition.

 

Can you suggest if this is possible to do and what should that condition be and how we can set up that condition?

Anonymous
Not applicable

One component can has only one runIf connector to the same target component, so you can use three tJava components in this case, for example:

tJava1--oncomponentok--tJava2--runIf1--tRunJob1

|oncomponemntok **************--runIf2--tRunJob2

tJava3

--runIf3--linked to the same tRunJob1

--runIf4--linked to the same tRunJob2

 

set the same condition on runIf3 and runIf4, so that tRunJob1 and tRunJob2 will be both executed if the condition is met.