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

[resolved] Row Count for tMap Output

I must be missing something obvious. I need to make a processing decision based on whether or not I have rows in an output from a tMap, like exiting the job if there aren't any. I was looking for something like NB_LINE used by the file shapes but it would appear that information isn't available for tMap outputs.
Can anyone point me in the right direction for determining the rowcount from tMap output?
Thanks!
Labels (2)
6 Replies
Anonymous
Not applicable

Hi,
If I understand you well, do you want to count the total number of records have been proceed? If so please refer to this forum: https://community.talend.com/t5/Design-and-Development/resolved-R-Dipay-numb-f-w-pc/td-p/96601, I think it will be helpful for you.
If not, could you give us more info about your requirement? Elaborating your case with an example with input and expected output values will be appreciated.
Best regards
Sabrina
bchaney
Contributor
Contributor
Author

Hi Sabrina,
I'm looking for the row count for just one of the outputs from the tMap.
So far, I haven't hit a requirement to know the total records the tMap produced.
Thank you
- Bryan
Anonymous
Not applicable

Hi Bryan
You can define counter on tJavaFlex after tMap, and use a runIf connector to fires next processing base on a condition. see my screenshot
start code on tJavaFlex:
int nb=0;

main code on tJavaFlex:
nb++;

end code on tJavaFlex:
globalMap.put("nb_line",nb);//put the total nb of lines to a global vriable for use later when needed.
if(nb==0){
globalMap.put("hasData",false);
}else {
globalMap.put("hasData",true);
}

set the condition of runIf as below if you want to fire another process if the output has rows.
(Boolean)globalMap.get("hasData")
set the condition of runIf as below if you don't want to fire another process if the output has no rows.
!(Boolean)globalMap.get("hasData")
Shong
bchaney
Contributor
Contributor
Author

Thanks Shong! That looks like what I need.
Added that behavior into my solution & the job ends as it should.
Bryan
Anonymous
Not applicable

Thanks Shong! That looks like what I need.
Added that behavior into my solution & the job ends as it should.
Bryan

Good news, thanks for your feedback! 0683p000009MA9p.png
Shong
Anonymous
Not applicable

great solution. thanks