Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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);
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 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
Like I said, tidier ways to do it...