Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2006, 02:38 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about counting records based on condition

Hi all,
I'm doing some reports where counting records is extensively used; some of these counts have to be done based on some data in the returning records; for example, I've got the following data set:

Name ************ IsMember
---- --- --------
... M Y
... F N
... M N

and so on...

If I group my report based on '************' field, for example, I would like my report to show group name (M or F), number of members in this group (1 male member) and number of non-members in this group (1 non-member male), so the report should be something like:

Male - 1 member and 1 non-member
... *records where ************ = M will go here* ...

Female - 0 member and 1 non member
... *records where ************ = F will go here* ...

So, how can I do counting based on some conditions in the retured data within a group?

Any hint will be very much appreciated,

Thanks in advance,

Essam

 
Old May 31st, 2006, 03:35 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is the reply I got from someone called MrBill; and yes it is what I was looking for:

You would group on ************ and create two formulas:
// formual @MemberCount
If {table.IsMember} = "y" then 1 else 0

// formula @NonMemberCount
If {table.IsMember} = "n" then 1 else 0

Place the formulas in the detail section. You can suppress them if you want. For each formula do the following:
Right click > Insert > Summary. In the "calculate this summary" box select 'sum'. In the summary location box select group 1 (************). Click ok. This will place a sum of your formula fields in the group 1 footer. Drag the 'sum' fields to the group header if you want or leave in the footer.

Thanks MrBill :) and hope this will be helpful for all.






Similar Threads
Thread Thread Starter Forum Replies Last Post
QUERY EXECUTION based on IF condition drani C# 0 November 9th, 2007 04:14 PM
Pls help - Sorting based on condition kalwinhobbess Crystal Reports 0 September 10th, 2007 10:47 AM
Count nodes based of if condition suri_1811 XSLT 1 December 7th, 2006 08:00 PM
popup based on condition msrnivas General .NET 0 July 11th, 2005 05:52 PM
counting by date condition jojothelast Excel VBA 0 April 15th, 2004 02:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.