ktrinad Posted August 31, 2006 Share Posted August 31, 2006 By: Danny Liu - dsyliu Record Count 2003-06-13 07:57 Hi All, I am a newbie in iReport and I tried to create a simple report. Everything works fine except I don't know how to display record count in the summary band. My query is a simple "select * from customer" and I don't want to modify my query at all. Is there any alternative way to do this such as using variable? Please help me. Thank you. dsyliu By: Giulio Toffoli - gt78 RE: Record Count 2003-06-13 08:25 Create a Variable named i.e. MyCounter Set as calculation type = "count", as expression "new Integer(1)" and as reset type ="Report" and class=Integer. Create a textfield expression in the summary, set as expression $V{MyCounter} end set Integer as TextField class. Giulio By: Danny Liu - dsyliu RE: Record Count 2003-06-13 09:10 Giulio, I tried your suggestion and I got this compilation error: symbol : variable RecordCount location: class LTS value = (java.lang.Integer)($V(RecordCount)); ^ C:Documents and SettingsAdministratorMy DocumentsLTS.java:280: cannot resolve symbol symbol : variable RecordCount location: class LTS value = (java.lang.Integer)($V(RecordCount)); ^ C:Documents and SettingsAdministratorMy DocumentsLTS.java:433: cannot resolve symbol symbol : variable RecordCount location: class LTS value = (java.lang.Integer)($V(RecordCount)); ^ 3 errors at dori.jasper.engine.design.JRCompiler.compileReport(JRCompiler.java:148) at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:135) at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:123) at IReportCompiler.main(IReportCompiler.java:119) Abnormal termination! By: Giulio Toffoli - gt78 RE: Record Count 2003-06-14 05:55 The right syntax is $V{MyCounter} and not $V(MyCounter) (note {} and () parentesis). Giulio By: Danny Liu - dsyliu RE: Record Count 2003-06-17 11:38 Thank you Giulio, it works. I have another question, what if I want to have $V{MyCounter} multiply by 0.85 to display in another Text field? What's the syntax? and where can I find tutorial for iReport? Thank you dsyliu By: Giulio Toffoli - gt78 RE: Record Count 2003-06-17 13:56 This is the syntax: new Double( $V{MyCounter}.doubleValue() * 0.85 ) Note that $V{MyCounter} is an Object of class Double, so we have to retrive the double value rapresented by this object: we do this writing $V{MyCounter}.doubleValue(). Now we have to multiply it for 0.85. The expression is declared as Double, so we have to return a Double object. For thie reason we "create" a new double object... in this way: new Double( < a double value> ) The result is new Double( $V{MyCounter}.doubleValue() * 0.85 ) Tutorials.... I must write it.... for now all available documentation is on http://ireport.sf.net/docs.html Giulio 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