Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
HamJan
Contributor II
Contributor II

Do while loop

Hi.

I am trying to load data from multiple qvd:s and then save it like

LET Start = AddMonths(makedate(year(Today()), 1, 1),0);
LET End = AddMonths(makedate(year(Today()), 12, 31),0);
 
do while Start <= End
let YearMM = Year(date('$(Start)','YYYY-MM-DD'))*100+Month(date('$(Start)','YYYY-MM-DD'));  
NoConcatenate
 
TMP:
LOAD
    Field1,
    Field2,
    Field3
  
from [path/File_$(YearMM).qvd]
(qvd);
 
 
left Join(TMP)
Load
  Field1,
    Field2
    
FROM [Path/file2.qvd]
(qvd);
 
 
 
left join(TMP)
load distinct
Field1
    max(YearMM) as YearMM, 
    1 as MaxYearMM
resident TMP
group by Field1;
 
 
NoConcatenate
EndTable:
 
load 
*
resident TMP
where MaxYearMM=1;
 
 
Drop Table TMP;
LET Start = date(AddMonths('$(Start)',1),'YYYY-MM-DD');     
LOOP
 
store EndTable into [Path/endfile.qvd] (qvd);

 

But i can not get the loop logic to work so at the end it would go correctly. Any tips how to fix?

Labels (1)
0 Replies