Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How do I do a count on a list of items?
How do I do a count on a list of items? [message #1007184] Mon, 04 February 2013 20:13 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 2
Registered: November 2010
Junior Member
Hi, I'm pretty new to BIRTH. I was able to create a report that has a list of names from a users table in my database. The table name is "User" and the column name is "Name". What I want to do now is to have a list of the number of users that begin with each letter of the alphabet. So My list would look something like this:
Letter    Count
A         10
B         12
etc


How would I go about doing this?

Thanks!
Re: How do I do a count on a list of items? [message #1007206 is a reply to message #1007184] Tue, 05 February 2013 00:08 Go to previous messageGo to next message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
In the footer of your main table you could add 26 aggregations, one for each letter. Each operation would be COUNT and each would have Filter Expression of row["name"].charAt(0).toUpperCase() == "A", for example.
Niftier than that would probably require scripting and then you have to weigh up which one the person coming after you is likely to understand better

Brad
Re: How do I do a count on a list of items? [message #1007325 is a reply to message #1007206] Tue, 05 February 2013 14:37 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 2
Registered: November 2010
Junior Member
Ok thanks! I will try this out.

The other thing I though of was to use SQL and create a view in my database with the aggregations, then use that view as my dataset in the report.

[Updated on: Tue, 05 February 2013 14:38]

Report message to a moderator

Re: How do I do a count on a list of items? [message #1007355 is a reply to message #1007325] Tue, 05 February 2013 15:39 Go to previous messageGo to next message
Tomas Greif is currently offline Tomas GreifFriend
Messages: 53
Registered: September 2010
Member
I think using SQL is much better approach. You do not have to create view, you can write sql directly when defining datasets, like:
select
 left(upper(name)) as first_letter,
 count(*) as users
from 
 users
group by
 left(upper(name))
Re: How do I do a count on a list of items? [message #1007471 is a reply to message #1007355] Wed, 06 February 2013 03:18 Go to previous message
Brad Mising name is currently offline Brad Mising nameFriend
Messages: 21
Registered: September 2009
Junior Member
SQL is a great idea. I've only ever used BIRT for XML datasets
Previous Topic:BIRT-Viewer DB connection error
Next Topic:New IQuery instead of org.eclipse.datatools.connectivity.oda.IQuery
Goto Forum:
  


Current Time: Fri Apr 19 13:16:56 GMT 2024

Powered by FUDForum. Page generated in 0.02201 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top