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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

Inner join with for loop (code attached, correction needed)

Hi, i attach my code which up to concatenate with my initial qvd is okay. Next I want to inner join  (the final concatenated table) with a loop by date over 20/5/2021 straight from the db, so as to get info in daily pieces. This returns me 0 data though which is not true. Where is this code wrong? I could use your help so much. Thanks.

 

 

NoConcatenate
TempDate:
load Distinct date(floor(Date),'DD/MM/YYYY') as Date
where Date>'20/05/2021';

SQL SELECT date "Date"
FROM Table;


LET NumRows=NoOfRows('TempDate');
trace $(NumRows);
For n=1 To $(NumRows)
let vDate = Peek('Date',$(n)-1,'TempDate');
trace $(vDate);


TempTable:
NoConcatenate

LOAD id, filename;

SQL select
 tab2.id,tab2.date,
 tab3.f_id, tab3.`filename
from
Table2 tab2
inner join
Table3 tab3
on tab2.id=tab3.f_id
where date_format(tab2.date,"%d/%m/%Y")='$(vDate)' and tab1.id>'$(MaxID)';   //incremental implementation

 DROP TABLE TempTable;
next n;
// drop table TempDate;


Concatenate
Load * from [$(vPathQVD)Initial_*.qvd] (qvd)
 WHERE NOT EXISTS(id);

FOR i=1 To $(NumRows) 
let vDate2 = Peek('Date',$(i)-1,'TempDate');
Trace $(i);
Trace $(vDate2);
 inner Join
LOAD id as id;


SQL select
 tab2.id,tab2.date,
 tab3.f_id, tab3.`filename
from
Table2 tab2
inner join
Table3 tab3
on tab2.id=tab3.f_id
where date_format(tab2.date,"%d/%m/%Y")='$(vDate2)';

NEXT i;

1 Reply
ioannagr
Creator III
Creator III
Author

Anyone please? 🙂