Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
figwit
Contributor
Contributor

Cannot actually load the data in this load script

Hi everyone, I am at wits end. Database/BI development is not my specialty--I happened to know enough to navigate so the full development ended up in my lap (disclaimer--please excuse my shoddy script!)

I wrote the following after days of poring through the community but now that I've hit the load data stage... it doesn't actually execute the load script.

 

ExtractionDate:
Load
	Max(Date("Extraction Date", 'M/D/YYYY')) as MaxDate
From [lib://HotelAuditQVDs/Reservations2020.qvd]
(qvd);

Let vLastExtractionDate = peek('MaxDate', 0, 'ExtractionDate');

Drop Table ExtractionDate;

trace *** created $(vLastExtractionDate) ***;

Let vFileCount = 0;

For Each vFile in Filelist('[lib://ReservationsFolder/*.txt]');
	Let vFileDate = date(date#(Left(SubField('$(vFile)','/',-1),8), 'YYYYMMDD'), 'M/D/YYYY');
	If $(vFileDate) > $(vLastExtractionDate) Then
		Let vFileCount = $(vFileCount)+1;

trace *** loading $(vFile) ($(vFileDate)) ***;

IncrementalReservations:
LOAD
*
FROM $(vFile)
(txt, utf8, embedded labels, delimiter is '\t', msq);

Endif
Next vFile;

trace *** no more files. $(vFileCount) filed loaded ***;

 

 

The data load progress box goes straight from the $(vLastExtractionDate) trace to the "no more files" trace. It skips everything from Let vFileCount to Next vFile. Any advice on what to do?

Edit to add: Each week, I have a dump of 4 text files added to a folder with all the previous files. I want to load just the most recent four. They're all named YYYYMMDD_ABCDE.txt. My idea was to take the max date from the aggregated qvd file (which would be the date of the most recent file that was loaded) and compare it to the date of the file name and then loop through a load statement to load the 4 new files.

Labels (4)
0 Replies