• Index
  •  » Talend Enterprise Data Integration » General questions
  •  » separate between date and time to filter data

#1 2012-06-11 14:40:23

Gooner
Member
Registered: 2012-03-26
Posts: 25

separate between date and time to filter data

Hi,

I want to recover my database, the first date and last date of the score every day.

I've used tAggregateRow, with Group by "user id", but it only shows me the first day and the first date for each user.

http://a2.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/428391_318761328207942_1405269098_n.jpg

this is the result

http://a5.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/292588_318761378207937_791294797_n.jpg


I added group by "checktime" he displays all dates of the day, but i need only the first "date" of every day

http://a1.sphotos.ak.fbcdn.net/hphotos-ak-ash3/s720x720/543222_318761301541278_2089391206_n.jpg

this is the result

http://a3.sphotos.ak.fbcdn.net/hphotos-ak-snc6/s720x720/250857_318761354874606_918906715_n.jpg

what should i do please? sad

Offline

#2 2012-06-11 15:18:26

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: separate between date and time to filter data

Hi
Your images do not display!
About your request, you need to compute the interval time between first date and end date, and then use a tLoop to output each row. Can you please give us an example input data and what's your expected data?

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2012-06-11 16:38:38

Gooner
Member
Registered: 2012-03-26
Posts: 25

Re: separate between date and time to filter data

Hi,

this is a little example...

input table:

user_id ||  date

1         ||  2012-06-05  07:30:55
1         ||  2012-06-05  10:40:00
1         ||  2012-06-05  15:15:29
1         ||  2012-06-05  18:33:09
       
2         ||  2012-06-05  09:09:09
2         ||  2012-06-05  17:17:17
2         ||  2012-06-05  19:19:19

1         ||  2012-06-06  08:30:00
1         ||  2012-06-06  09:33:33
1         ||  2012-06-06  11:30:00
1         ||  2012-06-06  14:55:55

2         ||  2012-06-06  07:30:55
2         ||  2012-06-06  13:13:13

1         ||  2012-06-10  08:30:00
1         ||  2012-06-10  09:33:33
1         ||  2012-06-10  11:30:00

2         ||  2012-06-11  07:30:55
2         ||  2012-06-11  13:13:13
2         ||  2012-06-11  14:55:55



this is what i expect:

user_id ||  date

1         ||  2012-06-05  07:30:55
1         ||  2012-06-05  18:33:09

2         ||  2012-06-05  09:09:09
2         ||  2012-06-05  19:19:19

1         ||  2012-06-06  08:30:00
1         ||  2012-06-06  14:55:55

2         ||  2012-06-06  07:30:55
2         ||  2012-06-06  13:13:13

1         ||  2012-06-10  08:30:00
1         ||  2012-06-10  11:30:00

2         ||  2012-06-11  07:30:55
2         ||  2012-06-11  14:55:55

Offline

#4 2012-06-12 04:16:09

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: separate between date and time to filter data

Hi
Here a scenario showing how to implement your request.
code on tJavaRow_1

Code:

output_row.id = input_row.id;
output_row.date = TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", input_row.firstDate)+";"+TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", input_row.lastDate);

Result printed on the console:

Code:

Starting job topic24418 at 10:12 12/06/2012.


[statistics] connecting to socket on port 3579
[statistics] connected
.--+-------------------.
|      tLogRow_1       |
|=-+------------------=|
|id|date               |
|=-+------------------=|
|2 |2012-06-11 07:30:55|
|2 |2012-06-11 14:55:55|
|2 |2012-06-06 07:30:55|
|2 |2012-06-06 13:13:13|
|1 |2012-06-06 08:30:00|
|1 |2012-06-06 14:55:55|
|2 |2012-06-05 09:09:09|
|2 |2012-06-05 19:19:19|
|1 |2012-06-05 07:30:55|
|1 |2012-06-05 18:33:09|
|1 |2012-06-10 08:30:00|
|1 |2012-06-10 11:30:00|
'--+-------------------'

[statistics] disconnected
Job topic24418 ended at 10:12 12/06/2012. [exit code=0]

Best regards
Shong


Uploaded Images


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#5 2012-06-12 15:56:04

Gooner
Member
Registered: 2012-03-26
Posts: 25

Re: separate between date and time to filter data

Thanks a lot... I'll try your solution smile

Offline

  • Index
  •  » Talend Enterprise Data Integration » General questions
  •  » separate between date and time to filter data

Board footer

Powered by FluxBB