[resolved] Run If rownnum>1

One Star

[resolved] Run If rownnum>1

I need to add a conditional requirement to my job to end the job if no new records from a oracle component have been inserted into a record.  If new records have been added then I want to finish the rest of the job (run a stored procedure).  I think i can use 2 conditional run if components to accomplish this but I am running into issues with the syntax
i am going from a oracle_bulk component>>tjava>> run if true(tjava) or run if false(tjava) to try and accomplish this
i have the following code in the first java component which runs and returns true if the record count from the oracle component is greater than one.  However when I add the true/false i can a sytanx error.  What am I missing in the true and false tjava components?


int nb_line=((Integer)globalMap.get("tOracleOutputBulk_1_NB_LINE"));
if(nb_line>0){
globalMap.put("hasRows", true);
}else{
globalMap.put("hasRows", false);
}
System.out.println("hasRows: " + globalMap.get("hasRows"));


Accepted Solutions
One Star

Re: [resolved] Run If rownnum>1

I figured it out.  I was putting my condition in the java components instead of in the run if.  Thanks all!

View solution in original post


All Replies
Four Stars

Re: [resolved] Run If rownnum>1

We can get the rows count with the variable  "tMysqlInput_1_NB_LINE" and placed it in link condition like below. 
((Integer)globalMap.get("tMysqlInput_1_NB_LINE")) > 1
You can use Oracle component instead of mysql.
One Star

Re: [resolved] Run If rownnum>1

Looks like the screenshots of my job did not upload.  I am unclear what I need to update?  Should I remove the first java component that I have with the if then else condition?
 
false condition 

true condition
One Star

Re: [resolved] Run If rownnum>1

I figured it out.  I was putting my condition in the java components instead of in the run if.  Thanks all!

View solution in original post

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog