Jump to content
JasperReports Library 7.0 is now available ×

Trying to perform averages on columns


2004 IR Help

Recommended Posts

By: Alan Shiers - ashiers

Trying to perform averages on columns

2005-05-27 07:56

Hi there,

 

I'm new to JasperReports and trying to understand how it works. I'm trying to figure out what I'm doing wrong with my xml file. I'm using the OpenReports Designer to help me design the xml file but not getting much help on using the application. Perhaps someone here can help.

 

I declared a variable and referenced one of the fields from the database named Q2 and set the calculation element to "Average". Then in the columnFooter band I set a textField that calls the variable Q2Average to perform the average calculation on the column.

 

...

<field name="Q2" class="java.lang.Byte">

</field>

...

<variable name="Q2Average" class="java.lang.Integer" calculation="Average">

<variableExpression><![CDATA[$F{Q2}]]></variableExpression>

</variable>

...

<columnFooter>

<band height="20">

<textField evaluationTime="Report">

<reportElement positionType="Float" isPrintRepeatedValues="false" x="120" y="2" width="26" height="17"/>

<textElement>

<font fontName="sansserif" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$V{Q2Average} + "%"]]></textFieldExpression>

</textField>

</band>

</columnFooter>

 

Problem is, when I test it out, OpenReports Designer throws up an error message that states:

 

Error Evaluating Expression: variable_Q2Average

SourceText: $F{Q2}

 

I don't get it. What does it mean? What does it want me to do to fix it?

 

Please Advise,

 

Alan Shiers

 

 

 

 

By: Alan Shiers - ashiers

RE: Trying to perform averages on columns

2005-05-27 11:43

Ok, I've figured out my problem. No need to repond to this post.

 

Thanks,

 

Alan

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