singh758 Posted December 27, 2012 Share Posted December 27, 2012 how to do sum in ireport for example I have two columnfrom query i got column (ABC,EFG) in ireport i used Detail Band..i want to total field ABC EFG Total 200 0 200 500 300 400 0 100 300 700 200 800 200 0 1000 Link to comment Share on other sites More sharing options...
sanbez Posted December 27, 2012 Share Posted December 27, 2012 Create variable $V{ROW_SUM} and define variable expression for it as $F{ABC}+$F{EFG} and Calculation = 'Nothing'See example test report (JR 4.1.2)<?xml version="1.0" encoding="UTF-8"?> select 200 ABC, 0 EFG FROM DUALUNION ALL SELECT 500, 300 FROM DUALUNIoN ALL SELECT 700, 200 FROM DUAL $F{ABC} $F{EFG} $F{ABC}+$F{EFG} ABC EFG ROW_SUM $F{ABC} $F{EFG} $V{ROW_SUM} $V{ABC_SUM} $V{EFG_SUM} $V{ROW_SUM} [/code] Link to comment Share on other sites More sharing options...
singh758 Posted December 28, 2012 Author Share Posted December 28, 2012 thanx for reply i already try that but it will return row wise total but i want cumulative sum of tow column..... Link to comment Share on other sites More sharing options...
sanbez Posted December 28, 2012 Share Posted December 28, 2012 My test report calculate sum for row (total column) and total sum for all columns int report. In your table total value in second row = 400. Why this result? Write more precisely what are you want. Link to comment Share on other sites More sharing options...
singh758 Posted December 29, 2012 Author Share Posted December 29, 2012 for eg : in first row i got Total=200 in next line (500+(total)-300)=400) then next((0+(Total=400))-100)=300 then ((700+(total=300))-200)=800 then ((200+(total=800))-0)=1000 Link to comment Share on other sites More sharing options...
sanbez Posted January 9, 2013 Share Posted January 9, 2013 Define variable $V{DIFFERENCE} with expression = {$F{ABC}-$F{EFG} calculation = Nothing And define variable $V{SUM_DIFF} with expression = $V{DIFFERENCE} calculation = Sum In report display $V{SUM_DIFF} in detail section. Link to comment Share on other sites More sharing options...
singh758 Posted January 10, 2013 Author Share Posted January 10, 2013 thanx for reply It Will return like that...... ABC EFG Result Required 500 0 0 500 15743 0 0 16243 2000 0 0 18243 2000 0 0 20243 150 0 0 20393 5772 0 0 26165 110 0 0 26275 0 110 0 26165 0 200 0 25965 0 5772 0 20193 0 20193 40386 0 Link to comment Share on other sites More sharing options...
sanbez Posted January 10, 2013 Share Posted January 10, 2013 I am don't understand. Why in column "Result" all values = 0 ? Are you solve your problem or not? My test report wоrks fine. II can put it. Are you want to see my test report? Link to comment Share on other sites More sharing options...
singh758 Posted January 11, 2013 Author Share Posted January 11, 2013 yes i want to see ur test Report.. Link to comment Share on other sites More sharing options...
sanbez Posted January 11, 2013 Share Posted January 11, 2013 Link to comment Share on other sites More sharing options...
singh758 Posted January 14, 2013 Author Share Posted January 14, 2013 thanx for help.. now it's working... Link to comment Share on other sites More sharing options...
kcsekhar25 Posted June 19, 2013 Share Posted June 19, 2013 hi , i tried the same calculation but it is showing me null. my need is i have 3 cols a and b,c which are big decimal. i want to add a+b into variable v1. v2=v1/c please guide me whee i am doing wrong Link to comment Share on other sites More sharing options...
sanbez Posted June 19, 2013 Share Posted June 19, 2013 Nobody can't help you without information about problem. "but it is showing me null" - it is not enough to determine the error. Create new answer with description of problem. SHOW YOUR JRXML, define database (is it Oracle? Postgress, MSSQL? or is it JRBeanCollectionDataSource?...). Show version iReport (JasperServer?) After that you get a chance to get answer Link to comment Share on other sites More sharing options...
kcsekhar25 Posted July 25, 2013 Share Posted July 25, 2013 sorry. thoght as we are in same thread didn't give full information. i got it. i will post properly next time. 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