Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
vlad_komarov
Partner - Specialist III
Partner - Specialist III

RowNo function with Preceding load

Hello, all!

I am using a script (below) and I've noticed that the RowNo() function is not working properly when I am using a Preceding load.

Screen Shot 2017-08-15 at 10.38.06 AM.png

I've added two rows' counts: RowNumPre and RowNumMain, placed in the Pre-load and the main load statements respectively.

Here are the results: the values in the main load part are not correct:

Screen Shot 2017-08-15 at 10.41.26 AM.png

Every other function (FileName() in example above) are working fine.

An additional detail: I am loading the data from multiple files, so I am using a For each vFile in FileList() ... Next vFile loop....

Am I missing something?

Any comments/suggestions will be greatly appreciated.

Best regards,

Vladimir

6 Replies
sunny_talwar

Either use RecNo() in initial load or use RowNo() in the preceding load.... this is by design and have similar kind of structure as Peek and Previous

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Sunny,

Thanks for suggestion! I forgot about RecNo() vs. RowNo() differences.

But using RecNo() is still not working fully in my case (when using For each vFile in FileList() ... Next vFile loop).

It counts Records in each file separately. Which might be useful actually, but I did not expect that.

Here is the same data load (from two separate files) with RecNo count restarting with each file.

Screen Shot 2017-08-15 at 2.01.24 PM.png

Thanks for your suggestion, I will use it!

Regards,

Vlad

sunny_talwar

What is the problem with using RowNo() in the preceding load (your Row Num Pre)? That seems to be working, right?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

RecNo() is a counter for input records. RowNo() is the counter for output records. As Sunny stated, RowNo() only works in the topmost LOAD of a preceding load.

RecNo() will be reset for each new file read. Since you are not filtering and rows or creating additional rows, RowNo() in your case is also valid as a running counter of input rows.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Sunny, yes it's working, but not for the Total count. As rwunderlichhas mentioned below, the RecNo() counts Input records, so it resets the count for every new file in the loop. It should work identical with RowNo() count in case of "normal" preceding load.


Regards,

Vlad

vlad_komarov
Partner - Specialist III
Partner - Specialist III
Author

Rob,

Thank you for clarification.

Vlad