Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have one folder name like "DATA", in my folder i have 10 sub folders like "1,2,....10" in each sub folder having same field names,
but format is different like "xlsx,csv,txt,xlsx" how can i load all files at a time?
Regards
Mahesh
You will need to load each file type with a different load statement as the file type qualifier differs. You could loop over the file types, or do the load in steps;
For Each vFile in (....*.xlsx)
...load xlsx
Next
For Each vFile in (....*.csv)
... load csv
Next
Or get the file extension and set a variable to the correct file qualifier, and use the variable as the qualifier. The syntax checker will probably show errors.
vExt = SubField(vFile, '.', -1)
if vExt = 'xlsx' then
Set vQual = (ooxml, embedded labels, sheet is Sheet1);
else if vExt = 'csv' then
Set vQual = (txt, ....)
etc
end if
LOAD ...
FROM $(vFile)
$(vQual);
You could use a loop with dirlist and filelist (within the help is a good example of them by the topic of for each ...) and within them you could check the extension within a if-loop or a pick(match()) combination with a string-function like subfield() or the file-function fileextension(). Here a more practically example: Re: Declaration of code lines.
- Marcus
Hi Bro,
I need to load all files in single load statement.
Regards
This could be considered as one single-loadstatement with an overhead-loop through the folder/subfolder and checking the extension within a variable with returning the appropriate file-format statement which then is used in your real load-statement - and there won't be an easier way ...
- Marcus
Hi Bro,
is there any Process?
Regards
What do you mean with "Process"?
Hi Bro,
Any easy way to load all files in a single load statement.
Please read the above mentioned suggestions again - and yes you will need some own efforts to understand the logic and to adapt it to your own folders/files.
- Marcus