how to split row in multiple row

how to split row in multiple row

Hi Team,
i have requirement like below if hours greater than 30 then row should be slipted (hours/20) in multiple rows and (date-7) 
input
task,hours,date
xyz,40,2016/12/23
xyz,30,2016/11/12

output
xyz,20,2016/12/23
xyz,20,2016/12/17
xyz,30,2016/11/12
pls help me i m not able to solve how can we do this in talend.

thanks in advance.
regards
Shail
Sixteen Stars

Re: how to split row in multiple row

I responded to the other post you put up for this. Basically, it is a bit complicated to explain without lots of pictures and a lot of text. So instead, I put together an example of how to do this. Hope it helps. The example was built in Talend v562. It can be used by newer versions but not older versions. 
MultiplyRo… .zip

Re: how to split row in multiple row

Thanks for the reply but i m using talend 5.4.2 version of talend so i m not able to import the job Smiley Sad.

can you please share some screenshots or steps  over here so that it can help me out to understand the scenario. 

it is very high priority requirement.

Thanks 
Shail
Sixteen Stars

Re: how to split row in multiple row

OK, I suggest upgrading since v54 is old. But here are some screen shots....
This shows the job layout. I am randomly generating some data, using a tMap with a tJavaFlex to split the rows as you asked. The tLogRow prints the result.

The tMap looks like this. The areas to focus on are circled in red...


The tJavaFlex looks like this. This is most important section. It generates rows for every row required by the input number (hours). So, if the number is 100, 4 rows are generated. 3 with 30 and 1 with 10 as the number (hours) returned....


If you are still confused I suggest you download v562 or v6 and use the example I posted.

Re: how to split row in multiple row

Thanks for the help but how about date handling in each row?
based on condition if my row is split in two rows  then date should be -7 in each corresponding row which i have mentioned in my first post. 
 
Sixteen Stars

Re: how to split row in multiple row

I've shown you how to deal with the hardest part, any further changes to other columns can be dealt with in a similar way to how I changed the number of hours per row. For dates, you should look at the TalendDate routines. "addDate" will be useful.

Re: how to split row in multiple row

thank you so much it helped a lot Smiley Happy