Jump to content
Changes to the Jaspersoft community edition download ×

Grouping by two fields


2005 IR Help

Recommended Posts

By: Raphael Bauduin - raphinou

Grouping by two fields

2004-07-28 05:35

hi,

 

I would like to group by both $F{name} and $F(firstname}.

I'm currently concatenating them:

 

$F{name}+"***"+$F{firstnaem}

 

but wondered if there was a better solution....

 

Thanks.

 

Raph

 

 

 

 

By: Mykel Alvis - evilarchitect

RE: Grouping by two fields

2004-07-28 08:25

If you're using an SQL query to get your data (which it appears that you are), then you can make this calculation part of the query

I think these are right.

 

MySQL

Select concat(a,b) as name from blah where bletch

 

ANSI standard (supported by Postgres and Oracle)

select a || b as name from blah where bletch

 

SQLServer

select a+b as name from blah where bletch

 

I dunno if that's a "better" solution. It just makes your report less code-bound. The concatenation operation in databases is NOT particularly quick under any of the databases that I know.

 

What's the effect you're looking for? If the name is an identifying entity only for lastname + firstname, then your current solution should work fine, or you might get a modest performance improvement using my suggestion. Is that the only issue at work?

 

---

http://sourceforge.net/forum/forum.php?thread_id=1117740&forum_id=113530

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...