Jump to content
We've recently updated our Privacy Statement, available here ×

how to create a report with opening balance using jasper reports


emrizwan
Go to solution Solved by rajesh.sirsikar,

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 3 weeks later...

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 .

Link to comment
Share on other sites

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...