samed Posted May 7, 2008 Share Posted May 7, 2008 Hi,How can I count the contents of a group when a condition is satisfied?I would like to do this code with iReport using variables If (id ==0)Counter++ thanks Link to comment Share on other sites More sharing options...
SeanDay Posted May 7, 2008 Share Posted May 7, 2008 Hi Samed, Add a new variable and set: Calculation Type = SumVariable Class Type = Integer In the variable expression put your cirteria e.g. ($F{YEAR}.equals("1997"))?new Integer(1):new Integer(0) The above example will add 1 for each row in the group where the year = 1997. Add this variable to your report group footer. Sean Link to comment Share on other sites More sharing options...
samed Posted May 7, 2008 Author Share Posted May 7, 2008 Hi Saen, Many thanks for your help. I tried also the code ($F{StateID}.intValue()==0)?new Integer($V{myCount}.intValue()+1):new Integer($V{myCount}.intValue())Calculation Type = count Best regardssamed Link to comment Share on other sites More sharing options...
SeanDay Posted May 7, 2008 Share Posted May 7, 2008 Hi Samed, Did you get this to work OK with the sum (or the count), I can get the sum to work fine but count is a bit more tricky (although possible). Regards, Sean Link to comment Share on other sites More sharing options...
samed Posted May 7, 2008 Author Share Posted May 7, 2008 Hi Saen,It is possible to use both ways I got the same results.But your way seems to be easierThank you so muchBest regardssamed Link to comment Share on other sites More sharing options...
samed Posted May 7, 2008 Author Share Posted May 7, 2008 Hi Saen,Do you have any idea about this problem?I have created 3 nested reports. The main report includes subreport1 which includes subreport2. When I run my Main Report with JRViewer it works and everything is ok but when I put my reports on the jasper server I noticed that the server could not find the last Report so I become the following error message: net.sf.jasperreports.engine.JRRuntimeException:net.sf.jasperreports.engine.JRException: Could not load object from location: subreport2.jasper My question is: is it possible for the Jasperserver to recognize more than two level nested reports? thanks Link to comment Share on other sites More sharing options...
SeanDay Posted May 8, 2008 Share Posted May 8, 2008 Hi Samed, Yes, JasperServer can recognise 2 nested reports, I have used this before. I think the problem you have may be related to the file/name of the resource you have uploaded. I notice in the error you have that JasperServer is looking for subreport2.jasper. When working with JasperServer you need to uploade .jrxml files (not .jasper files which are what you use with iReports). You need to modify the subreport1.jrxml file subreport element to use subreport2.jrxml. Hope this helps. Regards Sean 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