Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Loading and storing of dynamic csvs to qvds

Hello all,

I have monthly csvs(24 csvs with monthly names) in one folder, which I have to load to appropriate monthly qvds.

I want to make a loop of loading these csvs.

Can anybody help me to build a procedure which loads csvs in a loop to qvds with the same names like csvs?

Thanks a lot!

1 Solution

Accepted Solutions
MVP
MVP

Re: Loading and storing of dynamic csvs to qvds

Hi

This line is wrong:

for each File in filelist (C:\Users\innas\Desktop\Qvd\QV_new\daily\ &'\'&'$(FilePath)')

Change it to this:

for each File in filelist ('C:\Users\innas\Desktop\Qvd\QV_new\daily\' & FilePath)

You also do not need this line:

SET sFile = '$(File)';


Just use File where you were using sFile.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
14 Replies
rajni_batra
Valued Contributor

Re: Loading and storing of dynamic csvs to qvds

FOR i = 1 to 12

LET vFileName = 'file' & '$(i)' & '.csv' ;

sales_table:

LOAD ....

FROM $(vFileName) (ansi, fix, no labels, header is 0, record is line) ;

NEXT

or some thing like this...

Not applicable

Re: Loading and storing of dynamic csvs to qvds

ok, I understood. But how do I do store to (?)qvd?How I make dynamic name to qvd?

rajni_batra
Valued Contributor

Re: Loading and storing of dynamic csvs to qvds

not possible because as per my understanding all fields name are same so they will get concate automatically.

will get store in a single QVD only....

u can add a flag by using filename() or filebasename()

hope to help!!!!

Not applicable

Re: Loading and storing of dynamic csvs to qvds

Thanks a lot!!!

Not applicable

Re: Loading and storing of dynamic csvs to qvds

Hi,

I am trying to do the following:

SET

ThousandSep=',';

SET DecimalSep='.';

SET MoneyThousandSep=',';

SET MoneyDecimalSep='.';

SET MoneyFormat='$#,##0.00;($#,##0.00)';

SET TimeFormat='h:mm:ss TT';

SET DateFormat='M/D/YYYY';

SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';









SET FilePath='*.csv';

set vFileName = 'file';



for each File in filelist (C:\Users\innas\Desktop\Qvd\QV_new\daily\ &'\'&'$(FilePath)')

   
SET sFile = '$(File)';

   
Directory;

   NetworkDomainDailyData:

   
LOAD *

   
FROM

    [$(sFile)]

    (
fix, codepage is 1252);



store * from NetworkDomainDailyData into C:\Users\innas\Desktop\Qvd\Sql_Data\$(vFileName).qvd(qvd);

drop table NetworkDomainDailyData;



   
next File

   

   
exit script;

and it does not load/store anything.

Where is my mistake?

rajni_batra
Valued Contributor

Re: Loading and storing of dynamic csvs to qvds

can u share the name of ur .csv files so that i could try it

Not applicable

Re: Loading and storing of dynamic csvs to qvds

Hi,

one of the csv files look like:

C:\Users\innas\Desktop\Qvd\QV_new\daily\ra_daily.csv

Thanks!!!

MVP
MVP

Re: Loading and storing of dynamic csvs to qvds

Hi

This line is wrong:

for each File in filelist (C:\Users\innas\Desktop\Qvd\QV_new\daily\ &'\'&'$(FilePath)')

Change it to this:

for each File in filelist ('C:\Users\innas\Desktop\Qvd\QV_new\daily\' & FilePath)

You also do not need this line:

SET sFile = '$(File)';


Just use File where you were using sFile.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Re: Loading and storing of dynamic csvs to qvds

Hi Jonathan,

your answer helped very much.

But now while loading I am getting the following error:

Error: File .\extdata.cpp, Line 2788

What can it be?

Thanks.

Community Browser