Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

files

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


4 Replies
zhadrakas
Specialist II
Specialist II

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

;

MK_QSL
MVP
MVP

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

Anil_Babu_Samineni

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?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MK_QSL
MVP
MVP

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.