Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
swati_rastogi27
Creator
Creator

Concatenate data from files in a folder

Hi Experts,

I have a folder ..\QVD_DataFiles in which I have monthly revenue files :

Revenue_Details_201401

Revenue_Details_201402

.

.

.

Revenue_Details_201702

All files starting 201401 are refreshed daily , so file create timestamp cannot be used.

Also , every month a new file gets added here.

I want to loop through all files in this folder , but specifying start and end date conditions

Lets say , I don't want data from 2014 files.

In that case ,suppose start_date=201504

End Date will always be current year month (201702)

How to concatenate data , from files , from specified date ranges?

11 Replies
Not applicable

Create like this

LET $(vEndMonth)=num(Month(Today())) &num(year(Today())) ;

swati_rastogi27
Creator
Creator
Author

This is how I implemented it:

LET vEndYear=Num(Year(Today()),'0000');

LET vStartYear=Num('2014','0000');

LET vDiffYear=$(vEndYear)-$(vStartYear);

for i=0 to $(vDiffYear) step 1

LET vYearBase = $(vStartYear) +$(i);

for  j = 1 to 12 step 1

LET vMonthBase = Num($(j),'00');

LET vYearMonth = $(vYearBase)$(vMonthBase);

TRACE 'YearMonth is' $(vYearMonth);

if isnull(filetime('$(lQVDPath)QVD_Revenue_Details_'&$(vYearMonth)&'.qvd')) Then

TRACE ' The file for ' $(vYearMonth);

TRACE 'does not exist';

ELSE

Revenue_Details:

load  *

from $(lQVDPath)QVD_Revenue_Details_$(vYearMonth).qvd(qvd) ;

END IF;

next;

next;

STORE Revenue_Details into $(lQVDPath)QVD_MD_Revenue_Details.qvd(qvd);

DROP TABLE Revenue_Details;