Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Folder Table:
FolderName
6709
6683
6893
5567
File Folder Structure would be as follows:
Source
FolderName
ORDER-FolderName.csv
SALES-FolderName.csv
PARTS-FolderName.csv
BUYER-FolderName.csv
REP-FolderName.csv
Example:
Source
6709
ORDER-6709.csv
SALES-6709.csv
PARTS-6709.csv
BUYER-6709.csv
REP-6709.csv
6683
ORDER-6709.csv
SALES-6709.csv
PARTS-6709.csv
BUYER-6709.csv
REP-6709.csv
Source\6709\ORDER-6709.csv
Source\6709\SALES-6709.csv
Source\6709\PARTS-6709.csv
Source\6709\BUYER-6709.csv
Source\6709\REP-6709.csv
I have to write a program to go through all Folders listed in the FolderName Field.
You can use some thing like below
Load * From Source\6709\*.csv
Wildcard will only help me read all files from the folder "6709". I want it to further pick files from subsequent folders i.e. 6683, 6893 and so on.
Since the files would have a standard format I want to use one single Load statement for the entire iteration of folders/files.
Thanks!
I've never tried this but have you tried:
load *
from
Source\*\*.csv;
Otherwise if you have a table of all the folders you can create a loop.
Something like below. I haven't tested it but it should work.
FolderTable:
LOAD * INLINE [
FolderName
6709
6683
6893
5567
];
For Each vFolder in FieldValueList('FolderName')
let vFileName = chr(39) & 'Source\' & vFolder & '\*.csv'& chr(39);
FileLoads:
Load *
from
$(vFileName)
(txt, codepage is 1252, no labels, delimiter is ',', msq);
Next;