Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
can I use a loop in the load script?
regards,
MT
sure.
here is an example:
SUB DoDir (Root)
FOR each File in filelist(Root& '\*.qvd')
LOAD
Right( '$(Root)', 😎 as uploadedDate,
timestamp,
[Entry No_],
[G_L Account No_],
AnoPC,
[Abertura AnoPC]
FROM
[$(File)]
(qvd);
NEXT File
FOR each Dir in dirlist (Root&'\*')
CALL DoDir(Dir)
NEXT Dir
END SUB
CALL DoDir('D:\qlikview\dados')
I have more QVD file distinct from date. I load always four max qvd.
Example i have there are qvd files: T3BAS2.20120131.qvd;T3BAS2.2012029.qvd;T3BAS2.20120331.qvd;T3BAS2.20120430.qvd;T3BAS2.20120530.qvd
T3BAS2.20120630.qvd;
I load the last 4 qvd :T3BAS2.20120331.qvd;T3BAS2.20120430.qvd;T3BAS2.20120530.qvd
T3BAS2.20120630.qvd;
than
DateW:
FIRST 1
LOAD mid(PARTITION_KEY,1,8) as Data
FROM $(PathRead)\T3BAS2_*(qvd)
;
Date:
noconcatenate
load Data
resident DateW order by Data desc;
drop table DateW;
let NumDate = rangemin(NoOfRows('Date')-1, 3); //carico al massimo 4 mesi
-------------------------------------------------------------------------------------------------------------
LOAD
--------------------------------------------------------------------------------------------------------------
if
not isnull(nooffields('Date')) then
for i = 0 to $(NumDate);
let files = peek('Data', $(i), 'Date');
let VIntestazione= if(isnull(nooffields('T3BAS2')),'T3BAS2:', 'concatenate('T3BAS2');
if filetime('$(PathRead)\T3BAS2_$(files).qvd') <> '' then
$(VIntestazione)
//T3BAS2_VIG:
LOAD C_VOCE,
C_SV ,
PARTITION_KEY,
AutoNumberHash256(PARTITION_KEY,C_VOCE&C_SV) as key_tav4,
CD_ISTITUTO_ORIG,
P01136 ,
P01133 ,
P00350,
P01130 ,
P00352,
P01017 ,
P01126 ,
P01127,
IMPORTO_SEGN
FROM
$(PathRead)\T3BAS2_$(files) (qvd);
end if
next i
end if
Hello
Marchetto
thanks cesar silva for the example