mortoza Posted December 25, 2006 Share Posted December 25, 2006 HiCan you please advise how do I get the cumulative of an specific column value for each row? for example, a customers transaction per date will have sales and payments. I need 3rd column to show accumulated balance. Can I do that?Rgds,Mortoza Link to comment Share on other sites More sharing options...
jmurray Posted January 4, 2007 Share Posted January 4, 2007 Assuming that you group by Customer, you can simply use a summing variable, like this: Code: <variable name="mySum" class="java.lang.Double" resetType="Group" resetGroup="Customer" calculation="Sum"> <variableExpression><![CDATA[new java.lang.Double($F{Purchase}.doubleValue() + $F{Payment}.doubleValue() )]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Double(0)]]></initialValueExpression> </variable> The TextField Expression for your running sum's textbox will then simply be the variable name (eg. $V{mySum} ) .Post edited by: jmurray, at: 2007/01/04 01:06 Link to comment Share on other sites More sharing options...
mortoza Posted January 5, 2007 Author Share Posted January 5, 2007 Hi jmurrayIt is only working for the current row. Please see the report (pdf).I want the balance should be cumulative of previous and current rows in each row. Can anyone help? Mortoza [file name=statement.pdf size=2197]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/statement.pdf[/file] Link to comment Share on other sites More sharing options...
mortoza Posted January 5, 2007 Author Share Posted January 5, 2007 Hi jmurrayIt is only working for the current row. Please see the report (pdf).I want the balance should be cumulative of previous and current rows in each row. Can anyone help? Mortoza [file name=statement-e4d480bbce44c69aa58834846a90be5f.pdf size=2197]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/statement-e4d480bbce44c69aa58834846a90be5f.pdf[/file] Link to comment Share on other sites More sharing options...
jmurray Posted January 5, 2007 Share Posted January 5, 2007 It looks like you haven't set you variable's Calculation Type to Sum Link to comment Share on other sites More sharing options...
mortoza Posted January 5, 2007 Author Share Posted January 5, 2007 Hello jmurrayI have use sum but producing same result! Can anyone help?Mortoza Link to comment Share on other sites More sharing options...
jmurray Posted January 6, 2007 Share Posted January 6, 2007 I will send you a sample jrxml file on Monday if you don't have a solution by then. Link to comment Share on other sites More sharing options...
jmurray Posted January 8, 2007 Share Posted January 8, 2007 Sample Solution [file name=mortozo.jrxml size=12498]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/mortozo.jrxml[/file] Link to comment Share on other sites More sharing options...
jmurray Posted January 8, 2007 Share Posted January 8, 2007 Sample Solution Output: [file name=mortozo.pdf size=1718]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/mortozo.pdf[/file] Link to comment Share on other sites More sharing options...
mortoza Posted January 8, 2007 Author Share Posted January 8, 2007 Hi jmurrayThanks. I tried to run the report, it looks the system is looking up for table in the database. Did you use any?MOrtoza Link to comment Share on other sites More sharing options...
jmurray Posted January 8, 2007 Share Posted January 8, 2007 Essentially no because all the data is hardcoded into the query, BUT you will need a valid Oracle or mySQL database connection available before it will work. Alternatively you can provide your own data source. Enough sppon feeding for now. Have fun. Link to comment Share on other sites More sharing options...
mortoza Posted January 12, 2007 Author Share Posted January 12, 2007 Hi jmurrayIt worked. Thanks for the help. Mortoza 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