jmolina Posted June 15, 2009 Share Posted June 15, 2009 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 thisPlease, 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 More sharing options...
mdahlman Posted June 15, 2009 Share Posted June 15, 2009 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 field3UNION 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 More sharing options...
jmolina Posted June 16, 2009 Author Share Posted June 16, 2009 I attached the file. Link to comment Share on other sites More sharing options...
jmolina Posted June 16, 2009 Author Share Posted June 16, 2009 Hi guys,I managed to figure it out, so thanks anyway....i think the problem was that i was using a parameter as my divisor instead of a variable...when i made it a variable then it worked fine. Link to comment Share on other sites More sharing options...
jmolina Posted June 16, 2009 Author Share Posted June 16, 2009 and thanks matt for the tip on the multiple charts. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now