Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rafael_gerhardt
Contributor
Contributor

Carga incremental baseada no nome do arquivo

Pessoal,

Ainda estou aprendendo o Qlikview... já pesquisei mas não consegui escrever um código que funcionasse para carga incremental baseado no nome do arquivo. Explico. Quero efetuar diariamente a carga do dado bruto recebido (.txt) para arquivos QVD de forma incremental. Tais arquivos txt são nomeados de acordo com tipo do documento e a última data dos registros ali contidos. Segue relação exemplificativa. Alguém poderia ajudar? Acrescento que por restrições da rede não consigo utilizar o comando EXECUTE CMD. Desde já agradeço.

Rafael.


nc_nc_20160222.TXT
nc_nc_20160223.TXT
nc_nc_20160224.TXT
nc_nc_20160225.TXT
nc_nc_20160226.TXT
nc_nc_20160229.TXT
nc_nc_20160301.TXT
nc_nc_20160302.TXT
nc_nc_20160303.TXT
nc_nc_20160304.TXT
nc_nc_20160307.TXT
nc_nc_20160308.TXT
nc_nc_20160309.TXT
nc_nc_20160310.TXT
nc_nc_20160311.TXT
nc_nc_20160314.TXT
nc_nc_20160315.TXT
nc_nc_20160316.TXT
nc_nc_20160317.TXT
nc_nc_20160318.TXT
nc_nc_20160321.TXT
nc_nc_20160322.TXT
nc_nc_20160323.TXT
2 Replies
vinieme12
Champion III
Champion III

I'm assuming you have still not created a QVD from your existing text files so lets create that first

For each TABLEFILE in filelist ('your_full_directory_path_here\*.TXT')

ALL_DATA:

LOAD

     Field1,

     Field2

FROM

$(TABLEFILE)

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

Next TABLEFILE

Store Table ALL_DATA  in fullpath\QVDNAME.QVD;

Now we have a QVD to append to; so from next day onward run the below script.(Adding to Bottom of table)

let vFilename  = 'nc_nc_' & DATE(now(),'YYYYMMDD') & '.TXT';

ALL_DATA:

LOAD *

FROM fullpath\QVDNAME.QVD

(QVD);

CONCATENATE

DailyData:

LOAD

     Fiel1,

     Field2

FROM

'you_full_path_here\'$(vFilename)

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

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
oknotsen
Master III
Master III

Don't start the same topic twice please, even when the 2nd topic is in another language.

The English version of this topic can be found here:

incremental load based on the file name

Topic locked.

May you live in interesting times!