Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
REjaz1662272866
Contributor
Contributor

RUN IF

Hi. My job requires me to run a job only if the employee gender is "woman", or else stop the job if it's a "man". I tried to the run the job via TJava component but it only lets me run the job via a numeric condition eg if age > 30. How do I make a context variable that of a string and how to go about this query?

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello,

As you cannot apply a condition directly to a flow, you can have two output flows from tMap with your condition as an expression filter on the output tables in tMap or 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 next step

e.g.

Input source--> tMap --flow--> tHashOutput --RunIf(context.gender.equals("Woman"))--> tHashInput --flow--> further job

--RunIf(context.gender.equals("Man"))--> tHashInput --flow--> tDie

Hope it helps.

Best regards

Sabrina

View solution in original post

2 Replies
Anonymous
Not applicable

Hello,

As you cannot apply a condition directly to a flow, you can have two output flows from tMap with your condition as an expression filter on the output tables in tMap or 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 next step

e.g.

Input source--> tMap --flow--> tHashOutput --RunIf(context.gender.equals("Woman"))--> tHashInput --flow--> further job

--RunIf(context.gender.equals("Man"))--> tHashInput --flow--> tDie

Hope it helps.

Best regards

Sabrina

REjaz1662272866
Contributor
Contributor
Author

Worked great, thankyou!