Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to loop through Multiple csv files from folder and generate Qvd for each file

Hi Techies,

How to load multiple csv files in single load statement in Qlikview.

Problem is ::::

I have a some files in one location.. my point of view i want to load all files and generate qvd data file for each source file.

It should be done dynamically..

In SSIS, it is possible, Is there any possibility using Foreach loop and variables.

Thanks

Chandra Mohan

3 Replies

Re: How to loop through Multiple csv files from folder and generate Qvd for each file

You could use a script like this or see the examples in help under "for ... next // for each ... next":

x:

Load *, filename() as FileName From Path\Prefix*.csv (txt, codepage is 1252, embedded labels, delimiter is '\t', no quotes)

let vFileCount = fieldvaluecount(FileName);

for i = 0 to $(vFileCount) - 1

let vFileName = peek('FileName', $(i), 'x');

temp:

noconcatenate Load * Resident x Where FileName = '$( vFileName)';

store temp into '$( vFileName)'.qvd (qvd);

drop table temp;

next

Which way will best suited is depend from your folder/filename-structure, amount of data ...

- Marcus

Not applicable

Re: How to loop through Multiple csv files from folder and generate Qvd for each file

Hi Marcus,

The Debugger skipping the Execution  and throwing an error at below code line.

Set vPath='C:\Users\chandra.mohanc\Desktop\QlikView Training\Sources\';

X:

Load *,
filename() as FileName
From $(vPath)*.csv
(txt, codepage is 1252, embedded labels, delimiter is '\t', no quotes);

Re: How to loop through Multiple csv files from folder and generate Qvd for each file

Try this and/or check the path:

From [$(vPath)*.csv] ...

Community Browser