Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Specialist II
Specialist II

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

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
Highlighted
Specialist II
Specialist II

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

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

Highlighted
Creator III
Creator III

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

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.

Highlighted
Creator III
Creator III

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

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

Highlighted
Specialist II
Specialist II

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

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.