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: 
Anonymous
Not applicable

Talend IF expression to compare tjava value

Hello,

My aims is to build a job that will do the following:

  1. Check if count on table = 0 
  2. if true insert data

This what I have done so far.

0683p000009M9Sz.pngJob Check Count

Step tMSSqlInput_1 : SELECT COUNT(*) AS CNT FROM TABLE

Step tJava_1 : context.var = row12.CNT;  (Assign count value to variable)

Step tJava_2 : System.out.println(context.var); (Print variable var value)

 

Now I'm looking for an expression that will do a check if tJava_1 value = 0  then proceed to data insertion(Operations)

 

This is what I have added in the if conditions 

((Integer)globalMap.get("tJava_2")).equals(0)

 

And its not working.

Can someone advice how I may proceed.

 

 

Labels (6)
3 Replies
billimmer
Creator III
Creator III

in your if connection use:

 

context.var==0

Anonymous
Not applicable
Author

Jobs fails
Exception in component tJava_2
java.lang.NullPointerException
at bi_rtm.alim_ods_0_1.ALIM_ODS.tJava_2Process(ALIM_ODS.java:1848)
at bi_rtm.alim_ods_0_1.ALIM_ODS.tMSSqlInput_1Process(ALIM_ODS.java:1777)
at bi_rtm.alim_ods_0_1.ALIM_ODS.tFileInputDelimited_11Process(ALIM_ODS.java:1453)
at bi_rtm.alim_ods_0_1.ALIM_ODS.runJobInTOS(ALIM_ODS.java:2916)
at bi_rtm.alim_ods_0_1.ALIM_ODS.main(ALIM_ODS.java:2718)
billimmer
Creator III
Creator III

then in tjava1 "row12.CNT " must be null.  Right?

 

test this by replacing your tjava1 code with something simple like 

 

context.var = 1;