Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vincecassel
Contributor III
Contributor III

Run if with multiples choices

Hi everybody,

I have a question, I know how to use the run if on Talend, using a tSetGlobalVar, but I want to do a more difficoult job.

I want to make a join between two different metadata tables, to know which tables I have to refresh, with the relative tRunJob.

I am trying this solution using a file, in which I put the name of the tables, putting them on a

tSetGlobalVar, but it doesn't work, so there is a method that I can use to make this thing?

Example: I have to refresh table 1 and table 3, my file tells me:

table1

table3

And I want to make a "Run if" trigger without losing any records.

I am using these condition:

((String)globalMap.get("test2")).equals("table1")

((String)globalMap.get("test2")).equals("table3")

But only the job of table3 starts.

Does anybody know how can I do?

Thanks

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

This is because the last value will overwrite the previous values, if you want to iterate each table, change the job design as below;

tFileInputDelimitd--main(row1)--tFlowToiterate--iterate--tJava--runif1--tRunJob3

--runif2---tRunJob4

 

set the condition of runIf1 as:

row1.columnName.equals("table1")

 

set the condition of runIf2 as:

row1.columnName.equals("table3")

 

View solution in original post

6 Replies
Anonymous
Not applicable

How do you load the value of file? Using tContextLoad? Can you please share a screenshot of your job?

JohnRMK
Creator II
Creator II

Hello,

 

already to start, it is advisable to compare the variable to the fixed value

so "test1" .equals (...) to avoid null values

 

Then, can you share your job because there is no particular difficulty?

 

you can have for example this pattern

tWarn1 - RunIf_1 (condition) -> tRunJob_1

|

|

tWarn2 - RunIf_2 (condition) -> tRunJob_2

...

with : |

|

OnSubjobOk

vincecassel
Contributor III
Contributor III
Author

I am using a little job to better understand how can I do.

 

 

It is so simple, but when I run it, it doesn't work for the first if (although there is "table1" on the file)

vincecassel
Contributor III
Contributor III
Author

0693p000009H7zcAAC.png

Anonymous
Not applicable

This is because the last value will overwrite the previous values, if you want to iterate each table, change the job design as below;

tFileInputDelimitd--main(row1)--tFlowToiterate--iterate--tJava--runif1--tRunJob3

--runif2---tRunJob4

 

set the condition of runIf1 as:

row1.columnName.equals("table1")

 

set the condition of runIf2 as:

row1.columnName.equals("table3")

 

vincecassel
Contributor III
Contributor III
Author

It works!

Thank you so much!