Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hello!
I have a STG where it loads all the fields from CSV files that are continuously being generated over time.
TMP_TABLE: // I force the table to have this fields
LOAD * INLINE [
ACCOUNT_ID, DATE
];
CONCATENATE
LOAD *
FROM ..\Obs_*.csv (txt, utf8, embedded labels, delimiter is ',', msq);
The thing is that the first time that I run this load, I get an error because there aren't any generated files and it can't load anything...
Do you know if there's any way to omit if there aren't any loaded CSV files yet without showing an error, so that it would show a blank file only with the headers and no data at the first time?
Thank you!
 ali_hijazi
		
			ali_hijazi
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		if not isnull(filesize('path_to_your_file')) then
load...
endif
 ali_hijazi
		
			ali_hijazi
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		if not isnull(filesize('path_to_your_file')) then
load...
endif
 
					
				
		
Thank you very much! It worked!
 
					
				
		
.png) hic
		
			hic
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		An alternative, more elegant way, would be the following:
Set vConcatenatePrefix = ;
For each vFileName in FileList('C:\Path\*.csv')
$(vConcatenatePrefix)
Load * From [$(vFileName)] (...) ;
Set vConcatenatePrefix = Concatenate;
Next vFileName
FileList returns a list of files. If there are no files, the loop is never entered. The first loop, the vConcatenatePrefix will expand to an empty string. The second loop, it will expand to 'Concatenate'.
HIC
 
					
				
		
Thank you Henric! I'm going to try it and tell you the results! 
