Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection-problem

Status
Not open for further replies.

mroos81

MIS
Nov 14, 2003
16
NL
Hello everybody,

I have the following problem with Crystal Reports formulas (I'm working with version 7).

I want to make some sort of SQL-selection, a selection with conditions. So far, I have the following formula:

if {OPL_UITVOERING.STATUS_CODE} = "DE" or {OPL_UITVOERING.STATUS_CODE} = "DEOP"
then count ({OPL_INSCHRIJVING_MODULE.ID}, {OPL_UITVOERING.ID});

This isn't working in the right way, because now all the "OPL_UITVOERING.ID" are counted, and I just want the ones that have a certain status_code.

In SQL that would be something like:

select count (status_code) as TEST from opl_uitvoering where status_code = "DE" or "DEOP";

Can anybody help me with this problem?

Many thanks,

Michael Roos
 
I'm not sure why you are doing this on the SQL side if you are pulling over all the records.

I would create a DETAIL formula like -

NAME : {@BinaryDEorDEOP}
FORMULA :IF ({OPL_UITVOERING.STATUS_CODE} = "DE" OR {OPL_UITVOERING.STATUS_CODE} = "DEOP") THEN 1 ELSE 0

Then do a summary count of that field in Crystal.

Hope it helps...
 
Using MJTBIM's formula, you would need to do a sum, not a count, since a "0" will result in a count of 1, but will sum to 0.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top