Jump to content
Changes to the Jaspersoft community edition download ×

Jasper report variable printing zero value


daad.madhusudan

Recommended Posts

I am working on a jasper report in which I am using following SQL query:

 

    select SOURCE, count(*) as total

    from CASE_UPLOADS

    where UPLOAD_DT >= '20150601'

    and UPLOAD_DT <= '20150630'

    group by SOURCE

    order by SOURCE

 

and the result is:

 

 

    SOURCE,TOTAL

    "New Application";15

    "Periodic Report";16

    "RD/RC";25

 

I have created variable like:

 

    <variable name="PR" class="java.lang.Integer" calculation="Sum">

<variableExpression><![CDATA[($F{source} == 'Periodic_Report') ? $F{total} : 0]]></variableExpression>

</variable>

 

This variable is printing zero value each time.

 

If I change conditional clause as follow:

 

   <variable name="PR" class="java.lang.Integer" calculation="Sum">

<variableExpression><![CDATA[($F{source} == 'Periodic_Report') ? 0 : $F{total}]]></variableExpression>

</variable>

    

 

Then its printing SUM 56 of TOTAL column.

 

Can someone please tell me what is wrong here?

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Why you wrote at jaspersoft and stackoverflow the same wrong (uncorrect) question? You can't get right answer with this description.
You're wasting people's time. You must correct mistakes and show fields declarations. And show result with $F{source}.equals("Periodic Report")

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