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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Jennifer_siders
Contributor III
Contributor III

Null Handling from a query result

0683p000009MaTf.jpgi,

 

I have a simple job

 

Query Q1 - if the query returns records,then it will take Path1

                 - If the query doesnt return any record, then take path 2

 

From my Query Q1, i get a Id and i have built an expression in the tmap using the id as below. But though th query returns null or no records, still the flow doesn't take 'Record Doesnt exist' route.. ami missing something?

0683p000009MaIs.jpg

Labels (2)
7 Replies
TRF
Champion II
Champion II

It seems there is a syntax error on the expression "row5.id. == null" should be "row5.id == null" (no point after id).
If Q1 returns no result, it's normal to not pass by the "Record Doesnt exist route" (no record, no dataflow).
You will go there only for records where id is null (not empty if it's a string).
Jennifer_siders
Contributor III
Contributor III
Author

I have updated my screenshot, but still same result..

 

I have changed it to row5.Id == (" ") as Id is a Salesforce Record Id still no luck

Jennifer_siders
Contributor III
Contributor III
Author

Oh ok, @TRF  understood that if there are no records, then it will never take 'Record Doesnt Exist' path? if so how do we control the flow from a tsalesforceinput component in cases where there is no data returned?

TRF
Champion II
Champion II

Well, it depends of what you try to do.
Sometimes you may just do nothing.
Sometimes, you may store the query result to an intermediary object such as a file or tHashOutput then control the number of records stored in this object. Remember you may also retrieve the number of records return by the query using associated global variable such as "tSalesforceInput_1_NB_LINE" which is an integer.
TRF
Champion II
Champion II

Also careful, you should NEVER use == to compare string variables. Instead use equals() method like this "".equals(row5.Id)
Jennifer_siders
Contributor III
Contributor III
Author

Hi @TRF 

 

I think i am close to the solution. I have utilised NB_LINE.

 

As shown below, the NB_LINE value is 1 if there is a record and 0 if no records are found. how can i use that value tSalesforceInput_4.NB_LINE = 0 to change the path to Tmap_6->tSalesforceoutputbulkexec_2

 

0683p000009MaTu.jpg

Dave5
Contributor II
Contributor II

Hey @Jennifer Siders​ 

I'm having a similar issue (which I posted here). I'm not sure what you did in this picture but I'm wondering if you might have a moment to help me do a similar flow. Like you, I want a specific flow when a query returns no values.