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

Load Script Looping from a designated date forward

All,

I have a list of QVDs (CWR Transform 201610.qvd, CWR Transform 201611.qvd, CWR Transform 201612.qvd, etc) that I am trying to load and concatenate together into a single table.  There are many of these qvd files in the folder and I olny want to load the ones 201611 forward.

The file path for the qvds is

\\us1sawn03108\CWR\03_QVD\CWR Transform 201701.qvd]

Suggestions?

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

Try

Let vCWRYearMonthStart = Date(MakeDate(2016,11,1),'YYYYMM') ;

Let vCWRYearMonthEnd =Date(MakeDate(2017,1,1),'YYYYMM'); //This variable is the last month you have data

do

trace >> CWR Transform $(vCWRYearMonthStart).qvd;

Let vCWRYearMonthStart =Date(Addmonths(Date#($(vCWRYearMonthStart),'YYYYMM'),1),'YYYYMM') ;

Loop while $(vCWRYearMonthStart)<=$(vCWRYearMonthEnd);

View solution in original post

4 Replies
ger_alegria
Partner - Creator
Partner - Creator

You can try with something like this:

Set vYearMonthStart = 201611;

Set vYearMonthEnd = 201703; //This variable is the last month you have data

For i = $(vYearMonthStart) to $(vYearMonthEnd) step 1

Load *

From \\us1sawn03108\CWR\03_QVD\CWR Transform i.qvd];

NEXT

brf10043
Creator
Creator
Author

So when I load from a specific qvd file the load is successful.

Set vCWRYearMonthStart = 201611;

Set vCWRYearMonthEnd = 201701; //This variable is the last month you have data

For i = $(vCWRYearMonthStart) to $(vCWRYearMonthEnd) step 1;

Load *
 
From
[\\us1sawn03106\SourceDocuments\CWR\03_QVD\CWR Transform 201701.qvd]
(
qvd);

However when I load CWR Transform i.qvd I get a "Cannot open file '\\us1sawn03106\SourceDocuments\CWR\03_QVD\CWR Transform i.qvd' The system cannot find the file specified." Error message.  What am I missing?

Set vCWRYearMonthStart = 201611;

Set vCWRYearMonthEnd = 201701; //This variable is the last month you have data

For i = $(vCWRYearMonthStart) to $(vCWRYearMonthEnd) step 1;

Load *
From
[\\us1sawn03106\SourceDocuments\CWR\03_QVD\CWR Transform i.qvd]
(
qvd) ;

Next

sasiparupudi1
Master III
Master III

[\\us1sawn03106\SourceDocuments\CWR\03_QVD\CWR Transform i.qvd]


[\\us1sawn03106\SourceDocuments\CWR\03_QVD\CWR Transform $(i).qvd]

sasiparupudi1
Master III
Master III

Try

Let vCWRYearMonthStart = Date(MakeDate(2016,11,1),'YYYYMM') ;

Let vCWRYearMonthEnd =Date(MakeDate(2017,1,1),'YYYYMM'); //This variable is the last month you have data

do

trace >> CWR Transform $(vCWRYearMonthStart).qvd;

Let vCWRYearMonthStart =Date(Addmonths(Date#($(vCWRYearMonthStart),'YYYYMM'),1),'YYYYMM') ;

Loop while $(vCWRYearMonthStart)<=$(vCWRYearMonthEnd);