Skip to Content
Former Member

# problem with crysatl report

Hi,

I am developing a report by using crystal report in eclipse europa.

I have a problem that , i have a table which contains the two columns (Name, Gender)

I want to show two columns on report

1. Total number of male

2. Total Number of Female

so how to do that .

my logic:

i hv created a variable count for male and female and put filter that if gender=male then cnt++ else cnt1++

but i am not getting the exact result

please guide me step by step (if possible)

##### Add a comment
10|10000 characters needed characters exceeded

### 4 Answers

• Best Answer
Former Member
Posted on May 18, 2009 at 10:37 AM

Hi,

try the below methods

1.

whilePrintingRecords;

if male then maleCount++

else femaleCount++;

2.

whileReadingrecords;

if male then maleCount++

else femaleCount++;

Hope it will do help!

Thanks,

Saravanakumar.

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member
Posted on Apr 13, 2009 at 05:33 PM

Hello Pankaj,

Exactly what is the problem that you are facing?

Are you getting incorrect answers?Or are you getting any error messages?

Could you please specify?

Thanks.

Akshara.

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member
Posted on Apr 13, 2009 at 07:05 PM

Have you tried using two running totals, one has "gender = 'male'" and the other has "gender = 'female'"?

##### Add a comment
10|10000 characters needed characters exceeded
• Former Member Former Member

Hi,

You can use the command objects and can fire an SQL query like:

Select count(gender) from table_name where gender='female'
to get female count.

Select count(gender) from table_name where gender='male'
to get male count.

Thanks,

Neeraj

• Former Member
Posted on May 21, 2009 at 11:10 PM

Hi,

You can use this formula also:

numberVar f;

numbervar m;

if ({Sheet1_.Gender}="Female") then (f:=f+1;)

else m:=m+1;

"There are " & Mid(CStr(m),1,length(cstr(m))-3) & " Males and " & Mid(CStr(f),1,length(cstr(f))-3)& " Females";

Note:Sheet1_.Gender comes from Report Fields.

Please let me know the results.

Thanks,

Neeraj

##### Add a comment
10|10000 characters needed characters exceeded

### Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.