Jump to content
JasperReports Library 7.0 is now available ×

Availability Chart


jmolina

Recommended Posts

Hi everyone,

I'm new to iReport so I've been perusing the forums a lot for problems I've been having and for the most part I have gotten my answer because someone else had the same problem before me.  This time I cant seem to find anyone with a similar issue.

My problem is that I'm trying to create an availability graph (using a line graph) which is a percentage over time of a webpage returning a hit...anyway, I'm trying to calculate a percentage with the value axis (y-axis).

My expression is the following:

new Long( 100 * (1-( ($F{error_flag}.longValue()) /($P{REPORT_MAX_COUNT}.intValue()) )))

error_flag is a column in my DB that is either 1 or 0 and report_max_count is the total number of entries. What I want to do is show the percentage of time that the website is available, so if error_flag is 0, then it is available 100% but when I input this, iReport tells me the expression is valid but when I plot the graph I dont get any results at all, the graph is empty.  I'm totally stuck on this

Please, if anybody can tell me what I'm doing wrong, it would be so appreciated.

p.s.

Another problem I have is I dont know how to limit the graphs that get printed.  I have a database of 2000+ entries and I dont want to print 2000+ graphs plus that overloads the program and then it fails. How can I get it to print just once?

 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

jmolina,

 

The chart prints 2000 times because you have it in the details band. Put it in the Title or the Summary band instead.

 

Can you attach your .jrxml with a modified SQL query so that someone could run it without having your database? For example use a query like this:

 

SELECT 0 as error_flag, 'abc' as field2, 42 as field3
UNION SELECT 1 as error_flag, 'xyz' as field2, 13 as field3

 

From that it ought to be easy to see what's going wrong.

 

Regards,
Matt

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