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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Edith1
Creator
Creator

Need help with tLoop on tRestClient - Getting error on tJavaFlex

I’ve tried numerous ways to make this work and I’m still lost : (

The 1st subjob hashes out a table that I need the 4th subjob to iterate on each row to call the tRestClient.

The 2nd subjob is just to get the total # of rows from the 1st subjob.

The 3rd subjob just sets the varaible for the loop with the total # of rows. context.rowCount = (Integer)globalMap.get("tHashInput_2_NB_LINE");

I am having errors on the 4th subjob. The loop is ‘For ‘ each rowCount – I want this job to run through every row from the previous job. In this example 678 rows or times.

0693p000009JU0RAAW.jpg

0693p000009JU1AAAW.jpg

I have an IF condition for tDie of row28.errorCode>400

It runs 13 times, which is great because those 13 times are errors of 400, but then when I get a good rows of 200, I get error java.lang.NullPointerException: null for tJavaFlex_2

Why is the 200 or successful, going through the error channel? 

What am I doing wrong? Please help...I don't know how to make this work.

0693p000009JU1eAAG.jpg

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

The cause is row28.errorCode is null when you get a good row, the condition expression row28.errorCode>400 throws the error. To solve it, change the code on tJavaFlex as below:

System.err.println("ErrorCode: " + row28.errorCode + " ErrorMessage: " + row28.errorMessage);

if(row28.errorCode>400){

context.condition=true;

 

}else{

context.condition=false;

}

 

Define a context variable called condition and use it as condition expression of RunIf.

 

Regards

Shong

View solution in original post

4 Replies
Anonymous
Not applicable

Hi

Can you show us the Java code on tJavaFlex?

 

Regards

Shong

Edith1
Creator
Creator
Author

Hi @Shicong Hong​, it's just printing the error codes. Here's what I have in tJavaFlex

System.err.println("ErrorCode: " + row28.errorCode + " ErrorMessage: " + row28.errorMessage);

Anonymous
Not applicable

Hi

The cause is row28.errorCode is null when you get a good row, the condition expression row28.errorCode>400 throws the error. To solve it, change the code on tJavaFlex as below:

System.err.println("ErrorCode: " + row28.errorCode + " ErrorMessage: " + row28.errorMessage);

if(row28.errorCode>400){

context.condition=true;

 

}else{

context.condition=false;

}

 

Define a context variable called condition and use it as condition expression of RunIf.

 

Regards

Shong

Edith1
Creator
Creator
Author

Thank you @Shicong Hong​ for the solution. You are the best 😀