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

Smart way to load list of files from Folder

Hello

I need to load a list of qvds that are named this way QVD_YYYYMM, the purpose is to load only qvds that are from year(today)-2 to  year(today).

example if qvds are from 201201 to 201509 I need to load only the QVDs from QVD_201301 to QVD_201509.

the load is done by concatenation.

Thanks

1 Solution

Accepted Solutions
roger_stone
Creator III
Creator III

Something like this - there are several tidier ways you could achieve this.

LET vYearMinus2 = YEAR(TODAY())-2;

LET vYearMinus1 = YEAR(TODAY())-1;

LET vYearCurrent = YEAR(TODAY());


MyFiles:

LOAD *

FROM '$(vYearMinus2)*.qvd' (qvd);

LOAD *

FROM '$(vYearMinus1)*.qvd' (qvd);

LOAD *

FROM '$(vYearCurrent)*.qvd' (qvd);


View solution in original post

3 Replies
roger_stone
Creator III
Creator III

Something like this - there are several tidier ways you could achieve this.

LET vYearMinus2 = YEAR(TODAY())-2;

LET vYearMinus1 = YEAR(TODAY())-1;

LET vYearCurrent = YEAR(TODAY());


MyFiles:

LOAD *

FROM '$(vYearMinus2)*.qvd' (qvd);

LOAD *

FROM '$(vYearMinus1)*.qvd' (qvd);

LOAD *

FROM '$(vYearCurrent)*.qvd' (qvd);


Not applicable
Author

Not bad Roger here is my version

let vYear=  Year(today())-2;

LoadYears_temp:

LOAD Distinct

    "Year"  as Year_T

FROM [lCalendar.QVD]

(qvd)

where "Year">=$(vYear)

;

LoadYears:

LOAD Distinct

    Year_T as "Year"

Resident LoadYears_temp

order by Year_T asc

;

Drop table LoadYears_temp;

let vRowsY = NoOfRows('LoadYears');

   let i=0;

      For i=0 to $(vRowsY)-1

          let vYearLoad=peek('Year',$(i),'LoadYears');

                Table:

                 LOAD

                    *

               

                FROM [QVD_$(vYearLoad)*.QVD]

                (qvd);

Next

roger_stone
Creator III
Creator III

Like I said, tidier ways to do it...