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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

What is Count(*) in Java Script

Hello Talend Community,

 

I need a tMap Java Script Expression that would do the same thing as a COUNT(*) in SQL. This will be used in a Output Column in tMap Output Column Not a tJava Component.Need something similar to a ((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE")) you would use in a tJava Component. Not sure what the alternative it is in a tMap Expression

 

-Andrew

Labels (1)
1 Reply
TRF
Champion II
Champion II

In tMap you can use a sequence to count rows one by one. The final result will be available with the last row. You may also, store the result in a global variable. For that, define a local variable inside the tMap, for exemple i with the expression "0;". The semi-column is important as it allows you to write something else after such as "globalMap.put("count", Numeric.sequence("x", 1);" (this should work but not too clean in my opinion).
However, using a tAggregateRow is probably a better approach in most cases.