Jump to content

how to create a report with opening balance using jasper reports


Go to solution Solved by rajesh.sirsikar,

Recommended Posts

Posted

Hi,

I want to create a report with below format

   opening bal: 50
DatePaind InPaid OutBalance
01/01/15100 150
02/01/15 40110
03/01/15200 310


Please can you help on how a report with such a format can be created using ireport?

thanks

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
Posted

Hi Rajesh,

 

The data type of my columns are Decimal so I am using following expression in step 3 of your post.

 

IF(DECIMAL_VALUE($F{txn_cr})==0,-DECIMAL_VALUE($F{txn_dr}),DECIMAL_VALUE($F{txn_cr}))

 

when I run the report it throws below error

 

Error filling print... Error evaluating expression :      Source text : IF(DECIMAL_VALUE($F{txn_cr})==0,-DECIMAL_VALUE($F{txn_dr}),DECIMAL_VALUE($F{txn_cr}))

net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : IF(DECIMAL_VALUE($F{txn_cr})==0,-DECIMAL_VALUE($F{txn_dr}),DECIMAL_VALUE($F{txn_cr}))      at net.sf.jasperreports.engine.fill.JREvaluator.evaluateEstimated(JREvaluator.java:259)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluateEstimated(JRCalculator.java:580) 

 

 

Please can you advise?

 

thanks

Posted

HI Emrizwan,

 

I have used Integer_Values() function because my data from the datasource was in string and to perform my math calculation i had to convert it in to integer.

 

But in your case, since it is decimal you need not add "Decimal_Value" (On top of it, I don't think there is any expression called Decimal_Value)..So just put your expression as follows

 

IF($F{txn_cr})==0,-$F{txn_dr},$F{txn_cr})

 

Thanks,

Rajesh S

  • 3 weeks later...
Posted

To calculate the opening balance according to the amount of deposit and withdraw, you need to use the inter-row calculation which can be handled through Jasper expression. But the code is complicated and difficult to write. You can use esProc to work with Jasper and thus make this simpler. The esProc code is as follows:

A1=file("D:\data.csv").import@t(;",")

A2=result (t=43,A1.derive(t=t+Inputs-Outputs:Balance))

See code explanation from http://blog.raqsoft.com/?p=3540 .

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...