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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Karuetl
Creator II
Creator II

Issue with Using While Loop with Sql

I have an issue after implementing tLoop , it is not looping dates starting from 1981-02-21 until 1981-02-26 ..

It is starting from 1981-02-22.. 

 

Kindly help me out 

 

Gave values in the context as 

vStartDate = 1981-02-21

vEndDate = 1981-02-26

 

tJava_1 as below code 

java.util.Date start_date=TalendDate.parseDate("yyyy-MM-dd", context.vStartDate);
java.util.Date end_date=TalendDate.parseDate("yyyy-MM-dd", context.vEndDate);
long l=TalendDate.diffDate(end_date, start_date);
context.vDiff=l;
System.out.println(context.vDiff);
System.out.println(start_date);

tLoop gave as while loop as below 

context.vDiff>0L

In the DB sql query as below 

"SELECT emp.emp_no,
		emp.emp_name,
		emp.job_title,
		emp.manager_id,
		emp.hire_date,
		emp.salary,
		emp.commission,
		emp.dept_no
FROM	tempdw.emp
where emp.hire_date ='"+context.vStartDate+"'"

 

0683p000009Ls6n.png

 

 

 

 

 

 

 

 

 

Result as below 

0683p000009Lrte.png 

Labels (3)
10 Replies
Karuetl
Creator II
Creator II
Author

I have resolved the issue instead of OnSubJob OK , I used onComponent Ok .. It worked well ....