Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
jerownimow
Contributor III
Contributor III

how to process the next iteration when the first one failed?

Hi folks,


I have a subjob with the design below:
tHashInput -> tFlowtoIterate -> tFixedFlowInput ->tJavaRow -> tRestClient -> and so on...


So inside the tHashInput, I have a field called EmpDN which I want to be used as a parameter in tRestClient. To do this, I put the tFlowtoIterate and tFixedFlowInput, to get the EmpDN row by row value, and store it accordingly in a context variable via tJavaRow. The problem is, when the first output of EmpDN that has been stored in context and be used respectively in tRestClient  as a parameter and the response is an error or HTTP 404 Not Found, the job will stop already.

What I want to happen is, even if the tRestClient responded an error, it should still continue to iterate on the next value and so on.

Can you please help me how to achieve this?

Thank you in advance!

Labels (6)
1 Solution

Accepted Solutions
David_Beaty
Specialist
Specialist

Hi,

 

Something like:

 

tHashInput -> tFlowtoIterate -> tJavaFlex (iterate) -> tFixedFlowInput ->tJavaRow -> tRestClient ->

 

With the tJavaFlex setup like:

 

Start Code

globalMap.put("RestFailure", false);
try {

 

Main Code

(nothing)

 

End Code

} catch (Exception ex) {
globalMap.put("RestFailure", true);
}

View solution in original post

5 Replies
David_Beaty
Specialist
Specialist

Hi,

 

Couple of things to check/try.

 

1/ Untick the "Die on error" on the tRestClient component.

2/ Use a tJavaFlex component with the Java code of "try" & "catch", so you can handle the failure yourself/cleanly.

 

Thanks

 

David

jerownimow
Contributor III
Contributor III
Author

Hi David,

 

Thank you for your response. Die on error is already untick, but I haven't tried the tJavaflex.

 

Can  you expound how to use the tJavaFlex, and where to incorporate it on my current design? Thank you in advance.

David_Beaty
Specialist
Specialist

Hi,

 

Something like:

 

tHashInput -> tFlowtoIterate -> tJavaFlex (iterate) -> tFixedFlowInput ->tJavaRow -> tRestClient ->

 

With the tJavaFlex setup like:

 

Start Code

globalMap.put("RestFailure", false);
try {

 

Main Code

(nothing)

 

End Code

} catch (Exception ex) {
globalMap.put("RestFailure", true);
}

jerownimow
Contributor III
Contributor III
Author

Hi David,

It worked though I really don't get what does the code do. Thank you!

Just want to ask if there is a need for the RestFailure to be declared,or it is a default?
Anonymous
Not applicable

Thanks, David!

 

I really hadn't realized one could use tJavaFlex to handle try/catch, but it makes sense now that you say it.

 

Big thanks! 

 

Regards, Jan Terje