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: 
Dave5
Contributor II
Contributor II

How do I create a flow for no records found?

Hello. I have a simple REST API that has 2 main responses. A response for a record found (200) and a response when no records are found (490). I can't get the 490 response to trigger. The 200 works when the DBInput returns results.

 

Instead of getting a 490, I get a 404 (which I don't program). I think this suggests the application just fails after the query or at the map flow.

 

What kind of logic / componenets should I have in place to handle flows when no results are returned from the query?

 

Some screenshots are below to show what I have in place for logic.

0695b00000SqagsAAB.png0695b00000SqaiZAAR.png 

0695b00000SqaioAAB.png 

0695b00000SqaiyAAB.png

Labels (5)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

If there is no records, the components after tOracleInput will not be triggered. The workaround is to query the data and cache the into memory, and use runIf connector to trigger different subjobs.

eg:

.....tOracleInput1--main--tHashOutput1--runif1-->tHashInput1--tMap1--tRestResponse1

*********************************************** --runIf2-->tfixedFlowInput--tMap2--tRestResponse2

 

Set the condition of runIf1 as:

((Integer)globalMap.get("tDBInput_1_NB_LINE"))>0

 

Set the condition of runIf2 as:

((Integer)globalMap.get("tDBInput_1_NB_LINE"))=0

 

tfixedFlowInput: define the customized message and map it on tMap2.

 

Please try and let me know if you any questions.

 

Regards

Shong

 

 

View solution in original post

6 Replies
Anonymous
Not applicable

Hi

If there is no records, the components after tOracleInput will not be triggered. The workaround is to query the data and cache the into memory, and use runIf connector to trigger different subjobs.

eg:

.....tOracleInput1--main--tHashOutput1--runif1-->tHashInput1--tMap1--tRestResponse1

*********************************************** --runIf2-->tfixedFlowInput--tMap2--tRestResponse2

 

Set the condition of runIf1 as:

((Integer)globalMap.get("tDBInput_1_NB_LINE"))>0

 

Set the condition of runIf2 as:

((Integer)globalMap.get("tDBInput_1_NB_LINE"))=0

 

tfixedFlowInput: define the customized message and map it on tMap2.

 

Please try and let me know if you any questions.

 

Regards

Shong

 

 

Anonymous
Not applicable

I appreciate the information and advice you have shared.

Dave5
Contributor II
Contributor II
Author

Hey @Shicong Hong​ ! Thank you for the reply. This solution sounds promising. I'm a little confused still because I am not what components I should be using after the run-if statments. The options seem very limited. (see below). Could I ask for a little more direction on that please?

 

0695b00000SqgA9AAJ.png

Anonymous
Not applicable

I have gave an example job in my previous post, if you don't find tHashxxx component, please refer to this page to learn how show them.

 

Regards

Shong

Dave5
Contributor II
Contributor II
Author

Thanks. I was able to find the tHash with that link!

 

There seems to be an issue though with the logic used in the first if statement. I can't seem to make that work. Does anything jump out to you in these screenshots?

 

I appreciate the help. I'm still very new to Talend.

 

0695b00000SqkxoAAB.png 

0695b00000SqkxUAAR.png

Dave5
Contributor II
Contributor II
Author

I found these small syntax changes worked. I removed extra brackets, and changed the arythmatic logic slightly.

 

(Integer)globalMap.get("tDBInput_1_NB_LINE")>=1

(Integer)globalMap.get("tDBInput_1_NB_LINE")<=0