Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Top 5

Hi Experts,

please find the attached files

I have files  like

jan1

jan2

jan3

jan4

jan5

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

Expected output:-

jan5

jan4

jan3

for ex:- when I add   jan6,jan7,jan8,


here i need jan6 to jan8 files data.

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Kind of similar question. Check the below link.

Latest 3 Records

View solution in original post

12 Replies
tamilarasu
Champion
Champion

Kind of similar question. Check the below link.

Latest 3 Records

Not applicable
Author

Hi Nagraj,

i am not getting correct output.

please give example with my files.

qlikview979
Specialist
Specialist

Hi Nagraj,

i am not getting jan3,jan4,jan5 files data

please share  the example with my files

tamilarasu
Champion
Champion

Hello Manoj,

Is this your real file name.? How will you store the file for 2017, 2018 and so on..? If you want a dynamic code, you need to add year in the file name. (i.e Jan2_2015). Let me know.

Not applicable
Author

Hi,

Could you please see the below script and it will get to the Top 3 values. Please let me know if you find any issue.

sub DoDir (Root)

        for each File in filelist (Root&'\*.txt')

            input:

            Load '$(File)' as Name,

            FileSize('$(File)') as Size,

            FileTime('$(File)') as FileTime

            AutoGenerate 1;

         next File

end sub

call DoDir('D:\QlikView\community\214825')

NoConcatenate

input:

load     Name, Size, FileTime Resident input Order By FileTime Desc;

For vFileNo=1 to  NoOfRows('input')

      Let vFileName = Peek('Name',vFileNo-1,'input_file');

      Load *,

         '$(vFileName)' as FileName

      From [$(vFileName)];

EXIT for WHEN vFileNo='3';  

NEXT   

Thanks,
Sreeman

Not applicable
Author

Hi QV,

Did you try my solution? Can you please try it and let me know is it fine?

Thanks,
Sreeman

qlikview979
Specialist
Specialist

Hi,

i am not getting correct output. i will attach my files can you try with myfiles

tamilarasu
Champion
Champion

Mahesh,

    I can give you the code which will work for your sample files. But my question is how will you save your future files (i.e 2017, 2018)...?

Not applicable
Author

Hi Mahesh,

sure. please attach the files so that I will try it.

Thanks,
Sreeman