Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Howdy,
i'm trying to let my load script load from a wildcard file name and filetype.
What is wrong with this script? keeps failing...
TestData:
Load
orderNo,
CustomerNo,
Date
From
The problem is, is that sometimes there will be NO files in this directory...and i just want it to return nothing if that's the case. Though if there are files...i want the script to run.
Much thanks!
-David
This would skip if there are no files,
For each file in filelist('D:\Apps2\CUSTOMER\VendorOrder\$(vNewestFolder)\*.*')
TestData:
Load
orderNo,
CustomerNo,
Date
From [$(file)];
Next
But do you need an empty table if there are no files (as there would not be one created as the middle bit would never be called)?
It is possible to create empty table before loading from files:
TestData:
LOAD * INLINE [
oderNo, CustomerNo, Date];
For each file in filelist('D:\Apps2\CUSTOMER\VendorOrder\$(vNewestFolder)\*.*')
Concatenate(TestData) Load
orderNo,
CustomerNo,
Date
From [$(file)];
Next
In my production enviroment it's just for a mapping table, that I'm ok with not having any data ...just need the script to say if there are no files - we're all good keep going
How would i do it so it loads an empty mapping table??