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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to use Trigger Run If

How can I use trigger Run If in my application.I am using tReplicate to replicate data into n nuber of branch. I want branches should be executed on certain condition.

Labels (2)
18 Replies
Anonymous
Not applicable
Author

Does the Run If (that you explained) in the prior posts only work with Boolean expressions? Can we use it with an Integer (for example),
Run If (flag ==1), Run If (flag ==2) etc etc
alevy
Specialist
Specialist

The result of the expression must be true or false but you can use any data types or methods you want in determining the end result e.g.
context.FilePath.startsWith("C:\\") && context.TestDate.before(TalendDate.parseDate("yyyy-MM-dd","2009-06-30"))
|| context.RunNumber==1 && context.MaxValue.compareTo(BigDecimal.valueOf(100000.00))<0
Anonymous
Not applicable
Author

Thanks for your response alevy!
Well, that is where I am confused. If you use a boolean expression for the Run_If branches, we can only have two branches right (true or false). What if we needed more than three "Run_if" branches from a tJavaRow or a tJava component? That led me to use a flag of type Integer (flag =1 or flag =2 or flag =3) but I am getting a tJavaRow error with a type mismatch.
alevy
Specialist
Specialist

The expressions in each of the RunIfs are independent and do not have to be complementary i.e. you can have none or more than one RunIf triggered if that's what you want e.g.
RunIf (order:1) - context.FilePath.startsWith("C:\\")
RunIf (order:2) - context.FilePath.equals("")
RunIf (order:3) - context.TestDate==null
RunIf (order:4) - context.RunNumber>1
It's just like having multiple output flows from a tMap, each with different expression filters.
alevy
Specialist
Specialist

I am getting a tJavaRow error

I think it's very unlikely you would want a RunIf directly from a tJavaRow. All flows are completed before a RunIf link is tested so if your RunIf expression depends on data in the flow, it will only be tested from the last row of the flow. If you do want your RunIf tested for each row of the flow, you would need to have a tFlowToIterate.
Anonymous
Not applicable
Author

hi alevy,
Thanks for your quick responses and the caveat about the tJavaRow and Iterate.
Actually, I am only checking for one row in a file for the Run IF conditional so I should be ok without the Iterate. I do use the contents of the file later on for other purposes.

Thanks,
vladika
Contributor
Contributor

I think it's very unlikely you would want a RunIf directly from a tJavaRow. All flows are completed before a RunIf link is tested so if your RunIf expression depends on data in the flow, it will only be tested from the last row of the flow. If you do want your RunIf tested for each row of the flow, you would need to have a tFlowToIterate.

I have to say thank you for this Alevy 0683p000009MACn.png
Anonymous
Not applicable
Author

.
Anonymous
Not applicable
Author

I am getting a tJavaRow error

I think it's very unlikely you would want a RunIf directly from a tJavaRow.  All flows are completed before a RunIf link is tested so if your RunIf expression depends on data in the flow, it will only be tested from the last row of the flow.  If you do want your RunIf tested for each row of the flow, you would need to have a tFlowToIterate.

Alevy,
I have the exact situation you explained. I am reading a input redshift table for all the rows, and depending upon a column value each row has, i am triggering a new talend flow.
I am using tJavaRow (passing context variables) and my RunIf is only writing one record (as you correctely said), where do add tFlowToIterate to read all the rows and write ouputs accordingly?