Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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+"'"
Result as below
I have resolved the issue instead of OnSubJob OK , I used onComponent Ok .. It worked well ....
I would like to know how i can increment the startdate value and pass it to both loop and th equery
Refer to TalendDate routines
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+"'"
Result as below
Hi Karuetl
I think you don't configure the while condition correctly on tLoop. I have a similar case that does a loop on each month, see
context.monthStarting is a variable with int type.
I hope it gives you hints to do a loop on day interval.
Regards
Shong
issue is in the SQL query i am using the context.vStartDate value and for first time it is not passing the start value but the incremental one ...
I am actually incrementing using the tJava2 as below .... Still unable to get first vStartDate into the Query
Hi ,
Can u please attach the screenshot of tloop component section ?
Thanks ,
Praveen M.