Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vishalgoud
Creator III
Creator III

How to load different months qvd data in script in a single line/at a time.??

Experts

got a clear idea on what my requirement is :

i have 18 months of qvd data in the a folder with the same file name excpet year and month at the end, we have equal no of columns and name of the columns are also same in each qvd.

here i have to load last 12 months of data from jul-17 to aug -16.

file name is   salesdata_20160801.qvd

                     salesdata_20160901.qvd  ........

                    salesdata_20170601.qvd  

                   salesdata_20170701.qvd

Please help me with the for loop condition as i have no time to explore this.. bit urgent

Much Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable

Maybe

for each vFile in FileList('..\*.qvd')

    TableName:

    load

          '$(vFile)' as SourceFile,

          subfield('$(vFile)','_',-1) as DateN

          *

    from [$(vFile)] (qvd)

where subfield('$(vFile)','_',-1) <='20170701 ';

next

View solution in original post

4 Replies
Anonymous
Not applicable

Maybe

for each vFile in FileList('..\*.qvd')

    TableName:

    load

          '$(vFile)' as SourceFile,

          subfield('$(vFile)','_',-1) as DateN

          *

    from [$(vFile)] (qvd)

where subfield('$(vFile)','_',-1) <='20170701 ';

next

vishalgoud
Creator III
Creator III
Author

Thanks alot   wallo.

can you please elaborate more please include my seanario here in you above solution that would be great.

Bit confused with the logic.

vishalgoud
Creator III
Creator III
Author

Wallo ,

a small calrification this loop is going to repeat for last 12 months ??

its clear that it will take months on and before 20170701.

What is that DateN indicates in the scritp, Thanks again

Anonymous
Not applicable

It will pull in all the files <=20170701.

DateN is the data at the end of the file name after the underscore.

I picked DateN as the field name but it would really be anything.