Jump to content
Changes to the Jaspersoft community edition download ×

Use of arrays or lists

2004 IR Help

Recommended Posts

By: Neil Lamka - neil_lamka

Use of arrays or lists

2004-03-26 11:59

I have a situation where I need to collect a set of record values (from 0 to 3 sets) that consist of a string value and a long value. What I'm trying to produce, in the end, is something that looks like


xx - E

yy - V

zz - Q


where the xx, yy, zz are averages for each code and the character is the string code. What I thought would be easiest was to have 3 fields in the report with printwhen expressions that only printed if the value of the variable was non null and then use some technique to populate 3 variables during report generation. So, I set a variable

dH1 (double) with an expression that tried to figure out if the variable had been populated already as in

initial value= new java.lang.Long(0)

and then a variable expression like


where the field calc is what I want to save

then for the 2nd bucket I did

((0==dH2.longValue()) && (0!=dH1.longValue())?$F{calc}:$V{dH1}

thinking that this would only populate the dH2 variable if the dH1 one was non zero and I had not yet given dH2 a value. I tried a similar technique with the text fields.

But, as you might guess from my post, I could not get this to work for me.


So, (a) is there a simple/recommended way to get where I need to get or (b) if this looks right is there some problem with the calculation order/time or something that is messing me up here.


I am doing the printing in the summary section of the report because I also need to calculate the average of the dH1, dH2 values in order to get the end result I'm looking for.


Help or a pointer would be appreciated.




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