Jump to content
JasperReports Library 7.0 is now available ×

Problem in adding rowwise...!


Recommended Posts

By: Anuradha - anura

Problem in adding rowwise...!

2003-08-26 23:39

Hi...

I want to add all the fields in my report that are ROWWISE...how can i do it?

But in the "VALUES FORM" in "RESET TYPE" i find only "COLUMN"...that's 'am able to add only Columnwise...'n not rowwise...

If i specify the reset type as column, 'am getting error!

Plzz help me in this regard..!

 

thanx a lot..

Anuradha.

=====

 

 

 

 

By: Gary Hill - gary_hill94

RE: Problem in adding rowwise...!

2003-08-28 05:43

You have two options here. You can sum selected columns in each row in your SQL query like this:

 

SELECT columnA, columnB, (columnA + columnB) as columnC FROM tablename

 

Another alternative is to use a report variable to sum fields in each row. The variable expression to sum two Double fields would look something like this:

 

<variableExpression>new Double((($V{columnA}.doubleValue()) + ($V{columnB}.doubleValue()))</variableExpression>

 

To avoid errors you should test for null values like this:

 

<variableExpression>new Double((($V{columnA} != null)?$V{columnA}.doubleValue():0) + (($V{columnB}!=null)?$V{columnB}.doubleValue():0))</variableExpression>

 

The calculation type for this variable should be "Nothing".

 

Hope this helps.

 

 

 

 

By: Anuradha - anura

RE: Problem in adding rowwise...!

2003-08-28 08:21

Hey...

It worked out...Thanx a lot!

 

anu.

====

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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