selecting only first row of group in BIRT report [message #540193] |
Tue, 15 June 2010 06:44  |
Eclipse User |
|
|
|
Hi,
I have a list of next rows in report sorted by TIME_ID desc:
TIME_ID ID Name City
------------------------------------------------------------ --------
12:59:46 35 Mike New York
12:59:31 35 Mike New York
12:59:07 35 Mike New York
12:57:03 35 Mike New York
12:55:36 38 Jack Chicago
12:51:23 38 Jack Chicago
12:41:46 38 Jack Chicago
12:54:39 40 Danny Boston
12:54:02 40 Danny Boston
12:52:46 40 Danny Boston
------------------------------------------------------------ ----------
I need to get only one (first) row for each of group (every group differes by ID) with max TIME_ID. Example:
TIME_ID ID Name City
------------------------------------------------------------ --------
12:59:46 35 Mike New York
12:55:36 38 Jack Chicago
12:54:39 40 Danny Boston
------------------------------------------------------------ ----------
If this is possible, I would like the way without sql query because I use Jazz RTC connection to BIRT and writing SQL is not currently supported!
Any help would be appreciated!
Thanks,
Milan
|
|
|
|
Re: selecting only first row of group in BIRT report [message #540264 is a reply to message #540202] |
Tue, 15 June 2010 09:43   |
Eclipse User |
|
|
|
Hi Richard,
I didn't understand very vell your post. I created group over the table, and called it GROUP_ID. Then, I created aggregation named ROWNUM_IN_GROUP based on GROUP_ID, put it on new table column and got number of rows in group for each row.
As I understood, I must create a computed column in my dataset which is based on that aggregation, and set filter of that count to 1. The last part was not so clear to me, and if you can be more specified and write some steps, I would be gratefull to you!
Regars,
Milan
|
|
|
|
|
|
Re: selecting only first row of group in BIRT report [message #666173 is a reply to message #666165] |
Tue, 19 April 2011 07:57  |
Eclipse User |
|
|
|
If you want the first row of group, you can at the end of mentioned steps add filter and set it to 1.
If you want last row, you can count elements in your group. Add new aggregation, give some name (e.g. num_of_rows), use count method and select Aggregate on group and choose your group.
Then, use same steps from third Richard comment, and at the end, instead of your filter (which will be RUNNINGCOUNT) don't use filter equal to 1, use filter equal to num_of_rows, that is, the aggregation name of number of rows in group.
Hope this helps,
|
|
|
Powered by
FUDForum. Page generated in 0.16670 seconds