Solved

# HOW TO COUNT TRUE VALUES IN CRYSTAL REPORT.

Posted on 2004-08-30
2,898 Views
I have a formula set up to filter data in a column.
{tbOrders.OrderStatus}=220
It gives out me a boolean parameter true or false. What I need now is a count of positive  records(true).
In general i need to have a count of '220' record in a column grouped by another column(time).
Can anyone help me with that ??
Pawel
0
Question by:psokolo
• 3
• 3

LVL 28

Expert Comment

ID: 11930894
If you only want to count true values, create a formula to return a 1 or 0.

@Count_True

If {table.field} = True then
1
else
0

Place the field in your detail section and suppress it.
Right click the field and choose Insert, Summary.
In the box that opens up, the formula should be the field, make sure that summary type is SUM, and change the location to your Time Grouping.
0

LVL 10

Accepted Solution

ebolek earned 125 total points
ID: 11931100
Bdreed solution will work but if you dont want ti insert summaries you can get the total count in one formula like this. I have adjusted breeds formula

Regards
Emre

@Count_True

numbervar totalcount;

If {table.field} = True then
totalcount := totalcount +1
else
totalcount := totalcount
0

LVL 28

Expert Comment

ID: 11931170
Emre - This is true, there is mnore than one way to skin a cat.  The only difference is that your solution is only available at the end og a grouping or the report, whereas, is you need the total in the group or report headers, you will have to use the solution that I presented.
0

LVL 10

Expert Comment

ID: 11931204
That is true too. I only want to give him the other options like everybody else does. I think it is a good information to know that you can get the summary totals by using formulas too.

Regards
Emre
0

LVL 28

Expert Comment

ID: 11931280
No problem.  For that matter, you could also create a Running Total.
0

Author Comment

ID: 11932013
thank you very much
0

LVL 10

Expert Comment

ID: 11933128

Regards
Emre
0

## Featured Post

### Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.