Qlik Community

Qlik Brasil

Group community for Brazil users. discussion only in Portuguese.

Highlighted
clau2003cos
New Contributor III

Carregar alguns qvds

Boa tarde!

Tenho uns 50 qvds gerados com data e nome Ex:

20151127_NOMETABELA.QVD

20151126_NOMETABELA.QVD

20151125_NOMETABELA.QVD

.........

estou querendo caregar somente 10 desses 50 qvds.

E possivel fazer a leitura somente desses 10 fazendo um FOR?

Grato!

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Carregar alguns qvds

Small example with txt files, 4 files, I load 2 of them

Change (adapt) txt to qvd



// read all file names

FOR Each file in FileList('????????_NOMETABELA.TXT')

  trace $(file);

  FILES:

  load '$(file)' as file AutoGenerate 1;

NEXT; 

// new table with onle some (in my case 2) files, the first 2 order by file name desc

FILESTOREAD:

NoConcatenate

First 2 load file

Resident FILES

Order by file desc;

DROP Table FILES;

// read the 2 files

FOR i=0 to NoOfRows('FILESTOREAD') -1

  LET filetoread=Peek('file', $(i), 'FILESTOREAD');

  trace file to read $(filetoread);

  LOAD @1

  FROM

  [$(filetoread)]

  (txt, codepage is 1252, no labels, delimiter is '\t', msq);

NEXT;

1 Reply
MVP
MVP

Re: Carregar alguns qvds

Small example with txt files, 4 files, I load 2 of them

Change (adapt) txt to qvd



// read all file names

FOR Each file in FileList('????????_NOMETABELA.TXT')

  trace $(file);

  FILES:

  load '$(file)' as file AutoGenerate 1;

NEXT; 

// new table with onle some (in my case 2) files, the first 2 order by file name desc

FILESTOREAD:

NoConcatenate

First 2 load file

Resident FILES

Order by file desc;

DROP Table FILES;

// read the 2 files

FOR i=0 to NoOfRows('FILESTOREAD') -1

  LET filetoread=Peek('file', $(i), 'FILESTOREAD');

  trace file to read $(filetoread);

  LOAD @1

  FROM

  [$(filetoread)]

  (txt, codepage is 1252, no labels, delimiter is '\t', msq);

NEXT;