Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ferha_jafri
Partner - Creator III
Partner - Creator III

Want to load table within a loop

Hello Experts,

I have a requirement in which I want to load a table again and again for the loop.

let vStartYear = Year(Date(AddYears(Today(),-1),'YYYY-MM-DD'));

let vEndYear = Year(Date(AddYears(Today(),+1),'YYYY-MM-DD'));

do

NoConcatenate//Base to start
BasePop_Temp:
Load
Distinct
Com_Num_Base,
CompNumExist,
 PlT_Base,
EffDt_Bae,
ExpDt_Base,
Prd_Line_Base,
'Base' as Flag_Base,
Com_Num_Base&'-'&month(EffDt_Bae)&'-'&Prd_Line_Base as RenKey

Resident Table1 Where Year(Prd_Line_Base) = '$(vStartYear)';


NoConcatenate
BasePop: //next year
Load
Distinct

Com_Num_Base,
CompNumExist,
 PlT_Base,
EffDt_Bae,
ExpDt_Base,
Prd_Line_Base,
'Ren' as Flag_Base,
Com_Num_Base&'-'&Prd_Line_Base as EnhaceKey

Resident Table1 Where Year(EffDt_Bae) = '$(vStartYear)'+1 and Exists(RenKey,Com_Num_Base&'-'&Prd_Line_Base);

 

I want to load BasePop, which loads for each year to concatenate one after the other for each year.

Thanks in advance

Ferha

 

 

Labels (1)
1 Reply
marcus_sommer

Something like:

for i = $(vStartYear) to $(vEndYear)
   // defining n variables to consider different fields/expressions/conditions in the iterations
   YourTable: load ... resident ...;
next