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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

Loop load

Hi everyone. 

I have a folder with some amount of .qvds. Each file in this folder has a name like "Sub_YYYYMMDD". For each new day I have one new qvd with name that ends with a date when file was loaded (as example Sub_20200622) . 

When I need to load all files from the folder I use next loop 

TMP:
load * Inline [File_FK];

For Each File in Filelist('Folder\*.qvd')

Concatenate (TMP) Load * From [$(File)](qvd);

Next File

 

But also I need to load only part of the files I have in this folder. Lets say I need files that was loaded for the last 10 days till today. In other words I need to load files with names from 20200617 till 20200626. And I don't  understand how to put  this condition in the loop.  Need your help to understand how this condition may be implemented?

1 Solution

Accepted Solutions
Taoufiq_Zarra
MVP
MVP

Hi,

Maye be this version :

TMP:
load * Inline [File_FK];

For Each File in Filelist('Folder\*.qvd')

let vFlag=Floor(Date(today())-Date(Date#(left(right('$(File)',12),8),'YYYYMMDD')));
	
	if $(vFlag)<=10 then
		
		Concatenate (TMP)
		
		Load * From [$(File)](qvd);
	
	endif

Next File

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra
MVP
MVP

Hi,

Maye be this version :

TMP:
load * Inline [File_FK];

For Each File in Filelist('Folder\*.qvd')

let vFlag=Floor(Date(today())-Date(Date#(left(right('$(File)',12),8),'YYYYMMDD')));
	
	if $(vFlag)<=10 then
		
		Concatenate (TMP)
		
		Load * From [$(File)](qvd);
	
	endif

Next File

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Peony
Creator III
Creator III
Author

@Taoufiq_Zarra  Thank you. Your idea is helpful.