Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

doespirito
New Contributor III

Loading multiple qvd files and contenate them

hello,

Does anybody know why this script creates severals tables Contenu, Contenu-1, Contenu-2 in place of concatenate them in only 1 ?

Contenu_qvd:

LOAD fichierqvd

FROM

(ooxml, embedded labels, table is Feuil1);

For i=0 to NoOfRows('Contenu_qvd')-1

LET vQVD = Peek('fichierqvd','$(i)','Contenu_qvd');

CONTENU:

LOAD *,

filename() as Nomqvd,

datepar&'|'&editionsec&'|'&folio as %key

FROM ..\..\SourceDocuments\CONTENU\QVD_nrga\$(vQVD) (qvd);

next i;

I think that this script would work fine with .csv files isn't it ?

Thank you very much in advance .

Arnault

1 Solution

Accepted Solutions

Re: Loading multiple qvd files and contenate them

Contenu_qvd:

LOAD fichierqvd

FROM

(ooxml, embedded labels, table is Feuil1);

CONTENU:

LOAD * inline [

temp ];

For i=0 to NoOfRows('Contenu_qvd')-1

LET vQVD = Peek('fichierqvd','$(i)','Contenu_qvd');

concatenate(CONTENU)

LOAD *,

filename() as Nomqvd,

datepar&'|'&editionsec&'|'&folio as %key

FROM ..\..\SourceDocuments\CONTENU\QVD_nrga\$(vQVD) (qvd);

next i;

drop field temp ;

9 Replies
mattquinnterex
Contributor II

Re: Loading multiple qvd files and contenate them

Hi there,

Try only naming the top table in your script.

Then use the function Concatenate()


e.g.


Contenu_qvd:

LOAD fichierqvd

FROM

(ooxml, embedded labels, table is Feuil1);

For i=0 to NoOfRows('Contenu_qvd')-1

LET vQVD = Peek('fichierqvd','$(i)','Contenu_qvd');

Concatenate(Contenu_qvd)

LOAD *,

filename() as Nomqvd,

datepar&'|'&editionsec&'|'&folio as %key

FROM ..\..\SourceDocuments\CONTENU\QVD_nrga\$(vQVD) (qvd);

next i;

doespirito
New Contributor III

Re: Loading multiple qvd files and contenate them

thank you matthew,

Contenu_qvd is table with the qvds to load.

i want contenate them in a another table CONTENU .

A.

mattquinnterex
Contributor II

Re: Loading multiple qvd files and contenate them

So you want to load in each QVD and concatenate them,

then

Add the CONTENU table to the end of it?

doespirito
New Contributor III

Re: Loading multiple qvd files and contenate them

CONTENU does not pre-exist

CONTENU is the destination table of the qvd loaded in the loop

Re: Loading multiple qvd files and contenate them

Contenu_qvd:

LOAD fichierqvd

FROM

(ooxml, embedded labels, table is Feuil1);

CONTENU:

LOAD * inline [

temp ];

For i=0 to NoOfRows('Contenu_qvd')-1

LET vQVD = Peek('fichierqvd','$(i)','Contenu_qvd');

concatenate(CONTENU)

LOAD *,

filename() as Nomqvd,

datepar&'|'&editionsec&'|'&folio as %key

FROM ..\..\SourceDocuments\CONTENU\QVD_nrga\$(vQVD) (qvd);

next i;

drop field temp ;

doespirito
New Contributor III

Re: Loading multiple qvd files and contenate them

it works fine, thank you very much.

is this issue specific with qvd files.

because it works with xlsx files without initialisation of CONTENU table

see below

contenu_xls:

LOAD * INLINE [

    name

    tb1.xlsx

    tb2.xlsx

];

For i=0 to NoOfRows('contenu_xls')-1

LET vFIC = Peek('name','$(i)','contenu_xls');

CONTENU:

LOAD *

FROM

(ooxml, embedded labels, table is Feuil1);

next i;

Re: Loading multiple qvd files and contenate them

No it is not specific to file type, but if structure  of your all excel file is same then it works without concatenate, but if any of the file differs in structure it fails.(for eg. 1 file having 3 fields and other file having 4 fields) all field name should be identical

Re: Loading multiple qvd files and contenate them

Please close the thread by marking the correct answer

mattquinnterex
Contributor II

Re: Loading multiple qvd files and contenate them

Glad to see you got the correct answer below!