Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have 6 Files.. which resides in a particular location and multiple qvw files access to these files
invoice_01.xls
invoice_02.xls
invoice_03.xls
invoice_04.xls
invoice_05.xls
invoice_06.xls
But one qvw does not require invoice_06.xls .. so invoice_06.xls ..is their a way to exclude it
i dont know a way to do exlude this file in a FROM Statement.
What you can do is add a new field with the Filename and exclude all values from this field.
Not the best solution but it will work.
//Presceding Load
LOAD
YOUR LOAD STATEMENT WIHTOUT FIELD FILENAME
WHERE FILENAME <> 'invoice_06.xls'
;
//your original Load Statement
YOUR LOAD STATEMENT
, Filename() as FILENAME
;
Let vLocation = 'C:\Download\FolderName\Invoice'; //Change according to your actual folder path
Sub FindLatestFile(Root)
For Each FoundFile in FileList (Root & '\*.xls')
FileList:
Load
'$(FoundFile)' as FileName
AutoGenerate 1;
Next FoundFile
End Sub
Call FindLatestFile(vLocation);
FinalTable:
NoConcatenate
Load * Resident FileList Where Not WildMatch(FileName,'*invoice_06.xls*');
Drop Table FileList;
For i=0 to NoOfRows('FinalTable')-1
Let vFileToLoad = Peek('FileName',$(i),'FinalTable');
Data:
LOAD
Title
FROM
[$(vFileToLoad)]
(ooxml, embedded labels, table is Sheet1);
Next i
Excellent, this kind of script what we call. Subroutine or what?
Update: In that function you user root, What does it indicates it act as variable declaration or simple parsing value called root?
Whatever we have written between Sub and End Sub is called as Subroutine which we can call using Call Statement.
Root is the parameter which we need to pass while calling the subroutine.
Here Root is the Folder Path.