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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Name an output file with the number of lines of a tDBInput resultset

Hi all,

 

I've been using TOS for a couple of weeks, now comes the time to ask my first question to the community....

 

In my job I'm running a query on a MySQL database in order to extract a table content which is written into a csv file, via a tMap. Nothing uncommon, that's the easy part 0683p000009MACn.png

 

Now I would like the target file to be named according to the number of lines of the resultset.

Like "blablabla_currentdate_lineCount.csv"

 

I know about the NB_LINE global variable BUT it can't be used for this purpose, because as I understood it, global variables are only available once the job is finished, and the output file is created during  the job. So my file ends up called "blablabla_null" ... 0683p000009MPcz.png

Same problem if I involve the globalMap object to try and increment an integer on each row, it takes the first value (0, assigned in the prejob) and not the final one. (moreover in this last scenario, the resulting file is empty... But that's probably another issue)

 

0683p000009M1VX.jpg0683p000009M1Fa.jpg0683p000009M1Vc.jpg0683p000009M1Uk.jpg

 

Thank's a lot for your help, any suggestion would be greatly appreciated.

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Depending on the size of your result set, you can use the buffer components for this. You also can use the NB_LINE global variable instead of incrementing the count yourself.  The only restriction to using that is that it has to be after that entire subjob is complete to get an accurate count.

0683p000009M1Vm.png

  So with this strategy you are effectively caching the results of the query in the buffer, that allows the subjob to finish, then in the next subjob, retrieving the results of the buffer, and the completed query result set count.0683p000009M1Up.png

 

Edit: or you can just rename the file when the first subjob is done ¯\_(ツ)_/¯

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Depending on the size of your result set, you can use the buffer components for this. You also can use the NB_LINE global variable instead of incrementing the count yourself.  The only restriction to using that is that it has to be after that entire subjob is complete to get an accurate count.

0683p000009M1Vm.png

  So with this strategy you are effectively caching the results of the query in the buffer, that allows the subjob to finish, then in the next subjob, retrieving the results of the buffer, and the completed query result set count.0683p000009M1Up.png

 

Edit: or you can just rename the file when the first subjob is done ¯\_(ツ)_/¯

Anonymous
Not applicable
Author

Brilliant, exactly what was needed !
The fact is that you never really know what you can expect from a component before actually using it 😉
Thank you for sharing.