Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to load a list of csv files to qvds.
So I am doing it with a loop.
The issue is that every qvd has to have csv name in an appropriate order.
For example, I have ra_daily_2012-10-01.csv and ra_daily_2012_10_02.csv.
So I have to get ra_daily_2012-10-01.qvd and ra_daily_2012_10_02.qvd .
So how do I do an appropriate variable?
Thanks.
Hi,
You can use this insted of set vFileName, use both lines below:
let | vFileBaseName = SubField( File,'\',SubStringCount(File,'\')+1); |
let | vFileName = left ( vFileBaseName,FindOneOf(vFileBaseName, '.', SubStringCount(vFileBaseName, '.'))-1); |
File contains full path and filename
vFileBaseName will contain the full file name ( 2012-10-01.csv)
vFileName will remove the file extension.
(the expression is a bit long to make sure that only the string after the last '.' is removed)
Hope it helps,
Erich
Hi,
Is there a special requirement to read them in this specific order and in a loop?
You can avoid the loop using wild cards to read your .csv.
The syntax would be something like this:
Table:
Load *
from FOLDER\*.csv (txt) ;
Hope it helps,
Erich
Hi,
I am doing something like :
SET FilePath='*.csv';
set vFileName = 'file';
for each File in filelist ('C:\Users\innas\Desktop\Qvd\QV_new\daily\' & FilePath)
TRACE File = $(File);
SET sFile = '$(File)';
Directory;
NetworkDomainDailyData:
LOAD *
FROM
[$(sFile)]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
store * from NetworkDomainDailyData into C:\Users\innas\Desktop\Qvd\Sql_Data\$(vFileName).qvd(qvd);
drop table NetworkDomainDailyData;
next File
So what has to be in
set vFileName = ?
Thanks!!!
Hi,
You can use this insted of set vFileName, use both lines below:
let | vFileBaseName = SubField( File,'\',SubStringCount(File,'\')+1); |
let | vFileName = left ( vFileBaseName,FindOneOf(vFileBaseName, '.', SubStringCount(vFileBaseName, '.'))-1); |
File contains full path and filename
vFileBaseName will contain the full file name ( 2012-10-01.csv)
vFileName will remove the file extension.
(the expression is a bit long to make sure that only the string after the last '.' is removed)
Hope it helps,
Erich
Hi,
you really helped me!
Thanks a lot.
My model works:)
Hi Erich,
Can You Please expalin how the FIle Variable will load file path and File Name.
I have more than 100 Excel files in one folder.