Jump to content
Changes to the Jaspersoft community edition download ×

newbie layout question


Recommended Posts

By: abangkisp - abangkisp

newbie layout question

2003-01-27 21:13



i have the data in the database look like this


Account Group | Account Number


1 | 11

1 | 12

2 | 21

2 | 22

2 | 23

3 | 31

3 | 32


I want the data to be categorized by the accountGroup. And replace the number with my own label. The text is fix, 1 for house, 2 for car, and 3 for animals


So the report will look like this















could anyone help me?







By: Mark Rhodes - mrhodes2

RE: newbie layout question

2003-01-27 22:57

It is best to handle this in your query or view. Create a new table called Accountgroupnames and add to your view/query.


accountgroupname is a table with two fields;





sample query:


select accountgroup,accountnumber,accountname from accounts as a inner join accountgroupnames as b on a.accountgroup = b.accountgroup order by accountgroup,accountnumber


1 | 11 | house

1 | 12 | house

2 | 21 | car

2 | 22 | car

2 | 23 | car

3 | 31 |animal

3 | 32 |animal


In your report add a band/group on accountgroup and add the accountgroupname field your accountgroup band of your report.


If this were really only limited to the 1,2 and 3 you could create a new variable in jasper.


new String($F{accountgroup}.intValue()==1?"house":($F{accountgroup}.intValue()==2?"car":"animals"))


but as you can see this could get ugly if you had 5 or more of these to lookup and any time you added a new accountgroupname you would have to edit the report XML and recompile your report. Lookup the ? operator in a java manual for a more complete explanation.






By: abangkisp - abangkisp

RE: newbie layout question

2003-01-29 00:28



i think i use the second one because its fix.

i still need to practice using variable in jasper though.

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...