Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8486999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:06:33+00:00 2026-06-10T21:06:33+00:00

I have a Title band with a Text Field containing a calculated Variable $V{avg_perc}

  • 0

I have a Title band with a Text Field containing a calculated Variable $V{avg_perc}. The Text Field has the evaluationTime set to Report, same for the Variables resetType.
Now I’m trying to set the background color of this field with a Conditional Style but I keep getting an error message saying something like:

Invalid expression: !Double.isNaN($V{avg_perc}) && $V{avg_perc} >= 0.8

I’m doing exactly the same thing with the same Conditional Style in the Column Footer and it works without any problems, even if I set the evaluationTime for this field to Report too.

After removing !Double.isNaN($V{avg_perc}) I don’t get an error anymore but the expression still doesn’t work. My field stays red which is the basic color when none of the conditions is valid, no matter which value $V{avg_perc} has. It still works in the Column Footer, though. This is my style:

<style name="avg_color" mode="Opaque" backcolor="#FF0000" pdfFontName="Helvetica-Bold">
    <conditionalStyle>
        <conditionExpression><![CDATA[$V{avg_perc} >= 0.8]]></conditionExpression>
        <style backcolor="#008000"/>
    </conditionalStyle>
    <conditionalStyle>
        <conditionExpression><![CDATA[$V{avg_perc} >= 0.6 && $V{avg_perc} < 0.8]]></conditionExpression>
        <style backcolor="#FFCC00"/>
    </conditionalStyle>
</style>

Used Fields and Variables for this:

<field name="perc" class="java.lang.Double"/>
<variable name="avg_perc" class="java.lang.Double" calculation="Average">
    <variableExpression><![CDATA[$F{perc}]]></variableExpression>
</variable>

Any idea how to get this thing to work? I’m using JasperReports and iReport in version 3.7.4.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:06:35+00:00Added an answer on June 10, 2026 at 9:06 pm

    I finally found the solution for my problem. Adding

    <property name="net.sf.jasperreports.style.evaluation.time.enabled" value="true"/>
    

    at the report level causes a Conditional Style to be performed at the moment at which the element is evaluated.
    See this answer in the Jaspersoft Community for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have there domain classes: Person. (Person.ID, Name,Address) Designation.(Designation.ID, Title, Band) SalarySlip (Person.ID, Designation.ID,
I have a title bar in my application. And the title bar has one
I have a table that has multiple duplicate records as the following: ID Title
I have several classes, e.g. Band , Album , Song . Each has the
I have an album title of some music band. I want to draw it
I have three buttons with all same property other than their title. Titles are
I have a table with fields id , text , and title . There
I have a 'Title' column with abbreviations (Ceo, Cio,..) which I have to capitalize.
I have a title (h1) which is centered on the page. I want to
I want to have my title tag look like this: My Website - Name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.