Skip to Content
0
Former Member
Nov 10, 2009 at 11:07 PM

Count() function with selective criteria?

31 Views

I'm struggling with what I would expect to be a fundamental reporting concept in CR.

Suppose I have the following EMPLOYEE table:

u2022 EMPLOYEE.ID

u2022 EMPLOYEE.GENDER_CODE

u2022 EMPLOYEE.MANAGER_FLAG

I need to generate a statistical summary report containing the following:

u2022 Total number of Employees

u2022 Number of Male Employees

u2022 Number of Management Employees

This would be easy if I could just use a Count() function in the Function Workshop which

contained selective criteria. For example: Count ({EMPLOYEE.GENDER_CODE} = 'M')

But I can't figure out how to do this without getting a CR error message.

Record Selection doesn't work, because I need the whole data set.

Group Selection with Summaries doesn't work, because the gender and management

attributes are not mutually exclusive.

One solution that seems awkward to me is to create additional SQL commands in the

Database Expert using COUNT(*) and WHERE criteria to get the number of Males

and number of Managers. But I have to believe that there is a better way. Plus this

approach causes problems elsewhere in my report.

Am I missing something?

Thanks,

Bill