Jump to content
Changes to the Jaspersoft community edition download ×

filter expression and group expression


rajuchacha007

Recommended Posts

Hello experts,

I am using ireport 3.7.1. I would like to know ome technical infromation about group in ireport. Especially group and group headers. my query i working perfectly. I want to find a solution where I can group the data of the similar properties. I have gone through the sample example of groups in help of the ireport 3.7.1. Any information about grouping expression?

 

In simple words how/what expression should I use groups to group data? How extract data from databae and group it into desired criteria? Any examples or demo of the group expressions?

 

Best regards.



Post Edited by rajuchacha007 at 05/06/2010 14:21
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I'm smiling, I think sometimes you have some sort of allergy to study new topics  :)
In any case I try to explain "grossly" how to use groups.

as the name itself suggest, a group can be used to grouping data in set that make this data similar in some properties...

suppose you have the number from 0  to 10 in a table that you select from in your statement

num    | text | odd |
0               | zero       |       F    |
1               | one       |       T    |
2               | two        |       F    |
3               | three     |       T    |
4               | four       |       F    |
5               | five        |       T    |
6               | six         |       F    |
7               | seven   |       T    |
8               | eight     |       F    |
9               | nine      |       T    |
10             | ten        |       F    |

------------------------------------------------------------------------------------

first: create a grouping that group numbers using the first letter of text value

group expression: $F{TEXT}.substring(0,1)

group header: you can put a textfiled with text: $F{TEXT}.substring(0,1)

------------------------------------------------------------------------------------

now, other example, you can divide odd numbers:

group expression: $F{ODD}

group header: you can put a textfiled with text: $F{ODD}.equals("T")?"ODD":"EVEN"

------------------------------------------------------------------------------------

now, other example, you can divide numbers =< 5

group expression: new  Boolean( $F{NUM}.intValue()<=5)

group header: you can put a textfiled with text: F{NUM}.intValue()<=5?"MINOR":"MAJOR"     ===>latin fashion :)

------------------------------------------------------------------------------------
now, other example, you can divide numbers that name contains "o" from other:

group expression: new Boolean($F{TEXT}.contains("o"))

group header: you can put a textfiled with text: $F{TEXT}.contains("o")?"OK":"NO"

etc etc etc...

 

so, in the group expression you must set a rule that for each field generates a java Object (a String it's better...) that can be used to create a group of elements having the same generated value...
if you use a primary key of the field you obtain the same number of groups of your datased values!!!!

in group header you can put what you want... and something that shows the group value used to group the values that it contains...

 

are you ready to study it??

 

written listening Underworld - Cowgirl [Everything, Everything]

____________________________________
if it works... give me KARMA points please!    : ) 
____________________________________



 

 

 



Post Edited by slow at 05/07/2010 10:27
Link to comment
Share on other sites

@slow

 

Thank you very much friend for replying to my almost every post with patience and without any complaint. I resolved this issue two days back by placing expresion in group header and importing predefined variables. Your reply would be useful in future though definitely. I have already started to study it. :)

Link to comment
Share on other sites

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