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: 
PD2
Contributor
Contributor

How to detect "No Rows"

I am using the "tMap" component to join together several hash tables.
How can I detect that the join of the hash tables has resulted in "no rows?"
I would like to generate an e-mail when this happens.
Thanks
Peter
Labels (2)
3 Replies
Anonymous
Not applicable

Hi Peter
Link the output table from tMap to a tJavaFlex component, and use runIf connector to trigger the email component if the result of join is 0. For example:
....tMap--main--tJavaFlex
|
runIf
|
tSendMail
in the begin part of tJavaFlex, define a counter.
int nb_line=0;
in the main part of tJavaFlex, the counter will +1 if there comes an input row.
nb_line++;
in the end part of tJavaFlex, check the number of the counter if it is great than 0 or not, and store the result to a global variable for used later.
if(nb_line==0){
globalMap.put("isNoRow",true);
}else{
globalMap.put("isNoRow",false);
}
Set the condition of runIf with the global varaible,
(Boolean)globalMap.get('isNoRow")
Shong
Anonymous
Not applicable

Hi Peter,
- I have one more small Idea, Use a context variable as cnt and set its default value to 0.
- Use simple tjavarow at the output for that join and put following code
context.cnt = context.cnt +1;
Connect tSendMail component from tjavarow with condition RunIf having condition context.cnt == 0;

Check sample screenshot, you will get an idea for this.
Vaibhav
0683p000009MDlm.jpg
PD2
Contributor
Contributor
Author

Thanks for the ideas guys. I will try both.
Thanks!!!
Peter