Jump to content

Recommended Posts

Posted

Hi everyone

 

I am new with ireport-5.6.0

 

My Urgent Requirement is  to calculate total Male and Female from my report.

 

For Example

 

Student_Name   Gender

 

John                      Male

Rekha                   Female

Ravi                      Male

 

output:

Total Male=2

Total Female=1    

 

In my report i create Two Variable   one for male and another for female and set 

 

variable class=java.lang.Boolean

Calculation=Count

Reset Type=Column

Increment Type=Column

Variable Expression=$V{male}

 

and drag both variable in my report

 

when i click on preview its display null value

 

I am not using any sub report in my report but i add two parameter

 

i want to display my value in my column footer(column footer band)

 

I also test with my sql query

 

select count(*)  as total

  , sum( case when gender = 'male'

  then 1 else 0 end )    as male

  , sum( case when gender = 'female'

 then 1 else 0 end )    as female

 from testdb.student

where department='Computer Science '

 

when i test this query in my database(mysql) its worked perfectly but when i tryed this query in my ireport query box

 

its display wrong value

 

Thnaks in Advanced

 

Anwar

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Example for count Male.

Define variable:

Variable class = java.lang.Integer
Calculation = Sum
ResetType = Report
Increment type = None
Variable expression = $F{gender}.equals("Male")  ? 1 : 0

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