Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load from Wildcard filename & extension/filetype

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

4 Replies
chrismarlow
Specialist II
Specialist II

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)?

Anonymous
Not applicable
Author

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

Not applicable
Author

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

Not applicable
Author

How would i do it so it loads an empty mapping table??