You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi, im new in talend and i got to this problem
I have a table like this one:
id_truck action time
0005 EP 01/02/2003 13:10:00
0005 ET 01/02/2003 14:10:00
0005 ST 01/02/2003 15:10:00
0005 SP 01/02/2003 16:10:00
0005 EP 01/02/2003 17:10:00
0005 ET 01/02/2003 17:50:00
0005 ST 01/02/2003 18:10:00
0005 SP 01/02/2003 19:10:00
and i need a table like this
id_op id_truck EP ET ST SP
1 0005 01/02/2003 13:10:00 01/02/2003 14:10:00 ... ....
2 0005 01/02/2003 17:10:00 01/02/2003 17:50:00 ... ....
so that i have to do it with tpivot to change rows per columns but if i do that, it does a group by of truck number 0005 so that one of the registers got erased. Doesn't work making a new column with diferent id by sequence number on tmap before using tpivot because then it separates all the rows and thats not what i want. I just can think of making a loop so that every 4 rows it makes a new table and then do tpivot to all the tables and put them together by another tmap but i cant find no way of doing that...
Thanks a lot in advance ^^
Offline

Hi
I just can think of making a loop so that every 4 rows it makes a new table and then do tpivot to all the tables and put them together by another tmap but i cant find no way of doing that...
You can add a context variable into this job(e.g. sequence).
Part of your job should be like this.
tPivotToColumnsDelimited--OnComponentOk-->tJava
tPivotToColumnsDelimited: modify the file name "E:/TOS_DI-r75139-V5.0.1NB/workspace/out"+context.sequence+".csv"
tJava: context.sequence++
Then create a subjob to extract all data from each csv file into tHashOutput or tFileOutputDelimited.
tFileList--Iterate-->tFileInputDelmited--main-->tHashOutput(append)
Regards,
Pedro
Offline
Hi pedro
Thanks for your reply, i'll try it.
Regards,
Quim
Offline
Hi again Pedro,
Finally I didn't do as you told, I didn't understand pretty much of all that components, I have just worked by the time with oracle objects and tagregate :S To solve my problem I created to context variables and on tmap i wrote this code
context.cont++;
if (context.cont==5){
context.separator++;
context.cont=0;
};
Now it works great for first 2 rows but it gots crazy from the third, it erases some data and puts other in thw wrong row, do you know what the problem could be? Thanks in advance.
Regards,
Quim
Offline
Sorry it was an error of variable
Regards,
Quim
Offline
Pages: 1