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: 
Not applicable

TOP 5

Hi Experts,

I have one folder  files  like

jan1

jan2

jan3

jan4

jan5

jan6

jan7

jan8

jan9

jan10

if i go for reload i need top 5 files data.

Expected output:-

jan5

jan6

jan7

jan8

jan9

jan10

for ex:- when I add   jan11,jan12,jan13,jan14,jan15


here i need jan11 to jan15 files data.

2 Replies
sunny_talwar

Look through to extract the all the filenames in a folder and then put them in a table to find the Max 5 and then may be use Where Exist to only load the latest 5.

Look through idea: Loop through Folders and sub folders to get file names

Looping Through Files

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Something like this maybe

For each File in filelist ('Folder_Path')

     Files:

     LOAD

          '$(File)' as Name,

          num#(KeepChar('$(File)',0123456789)) As FileNumber

     autogenerate 1;

Next

ReadFiles:

FIRST 5

LOAD

     Name as FileName

RESIDENT

     Files

ORDER BY

     FileNumber Desc

     ;

For i = 1 to 5

     LET vFile = peek('FileName',$(i),'ReadFiles')

     LOAD * FROM $(vFile) (qvd);

Next

If you're not loading from qvd files then change (qvd) to the correct format specification for the type of source file you're using.


talk is cheap, supply exceeds demand