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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
talendtester
Creator III
Creator III

tJava - IF ELSE statement fails!

I run SQL and pass the result of "STOP or "GO" to tMap and then tContextLoad:

 

tTeradataInput > tMap > tContextLoad

˅

OnSubjobOK

˅

tJava

 

The tJava code is:

System.out.println( "Context variable value is:"+context.myCHECK);

 

globalMap.put("myCHECK", context.myCHECK);
System.out.println( "Global variable value is:"+globalMap.get("myCHECK"));

 

if(globalMap.get("myCHECK")=="STOP"){System.exit(99);}else{ System.out.println("START GOING NOW");}

 

System.out.println("FAILED TO STOP");

 

 

The result is correct when the context variable is GO:

Context variable value is:GO
Global variable value is:GO
START GOING NOW
FAILED TO STOP

 

But when the context variable is STOP the exit command doesn't trigger:
Context variable value is: STOP
Global variable value is: STOP
START GOING NOW
FAILED TO STOP

 

Any ideas how to make the if else statement actually exit the job?

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Hi,

Replace the "if" statement like this:

if(((String)globalMap.get("myCHECK")).equals("STOP")) System.exit(99);
System.out.println("START GOING NOW"); // no else require

 

View solution in original post

2 Replies
TRF
Champion II
Champion II

Hi,

Replace the "if" statement like this:

if(((String)globalMap.get("myCHECK")).equals("STOP")) System.exit(99);
System.out.println("START GOING NOW"); // no else require

 

talendtester
Creator III
Creator III
Author

Thanks!