Solved

Classifying a group and then count based on the classification

Posted on 2012-03-23
20
405 Views
Last Modified: 2012-06-27
I have a report in which I used the details section to classify my group.  I classified the group based on some selection and sorting formulas.  I now want to know how many of each type of group that I have based on the classification that I determined.  I tried using three running formulas that evaluated only a certain value, but the running total counts the information in the details section so I end up with inflated numbers.

My data is set up like so:

Group Name     Group Classification based on detail
detail
detail
detail

So it looks like this with data

case_ID          Type A
A
B
B

Case_ID 2       Type B
B
C

Case_ID3      Type C
C

So my goal would be to have a total that tells me that I have one of each type of group.  My running totals though are giving me a total of 1 for group A, 1 for group C, but 3 for group B.

Can I do what I want to do here?  This has plagued me for sometime and I am at a complete mental block so I am open to any suggestions.  I just need to get rid of my inflated numbers and make sure that each case_id (i.e. each group) is only counted once.  The difference is about 200 records and it is really messing up my statistics.

Also I have an intermediate level of crystal experience so very explicit instructions in any suggestions would be most appreciated.
0
Comment
Question by:josslmpd
  • 10
  • 9
20 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37757216
Set the runninig total to evaluate on change of group

mlmcc
0
 

Author Comment

by:josslmpd
ID: 37757762
If I evaluate on change of group it just counts the groups and gives me a total count.  I do not get a breakdown by type.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37757809
What field is the type?

I thought the CASEID was the group and the TYPE was what you wanted to count.

mlmcc
0
 

Author Comment

by:josslmpd
ID: 37757865
The type field is a formula that is displayed in the group header.  I do want to count TYPE.  IF I evaluate based on group is gives me a total count of the number of groups.  If I reset the count based on TYPE or group I don't get the correct information either.
0
 
LVL 19

Expert Comment

by:GJParker
ID: 37757894
I'm not following your description of the issue here,

how are you using the details to classify you groups ?
what groups do you have ?
what are you trying to count ?

It would be simpler to follow if you provided an example of the data and structure and what the expected outcome is
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37757924
Is the type the same for the entire group?
or is the type shown the type of the first record?

Have you tried a distinct count of the type formula?

mlmcc
0
 

Author Comment

by:josslmpd
ID: 37758049
Sorry for the poor description.  I am looking at crime data.  An incident may have multiple offenses associated with it, but I only want to count each incident once.  I also need to count it for the most serious crime.  All of the offenses for an incident are listed in the details.  I have a formula that classifys the individual offenses into a category (Homicide, Sex Crime, Assault, Other) and then a custom sort order that lists the offenses in order based on servity of crime.  The category formula is placed in the group header so that it only displays the most severe crime.

Incident 1     Homicide
Homicide
Assault

Incident 2    Rape
Rape
Burglary

Incident 3   Assault
Assault
Kidnapping
 
The running totals still counts the detail information, though, so it looks like six incidents occurred when there were really just 3.  I think my flaw is that the displayed information is not a "real field" it is really just displaying the first of the two records.  So it works for display but not for statistics.  I don't know how to make that field "real" enough for summary information.  I can always export the report to excel and do a count, but I was hoping to do it all in a single report with crystal and or SQL.

Hopefully this description is a little clearer and not worse.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37758267
How do you have the running total setup.

It would seem you want to count/evaluate when the INCIDENT field/group changes

mlmcc
0
 

Author Comment

by:josslmpd
ID: 37758285
The INCIDENT field changes everytime though.  As I said, counting on that group just gives me a total count of incidents.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37758290
What is the group?

For the above data you need 3?

Can you upload the report?
No data needed

mlmcc
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:josslmpd
ID: 37758356
The group is the incident ID.  If the formula was working correctly, for the above data I would have three total incidents, one of each type.
incidentbyoffense.rpt
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37758421
Try this one.  It evaluates on the change of the group.

Are you trying to get the number of each "subtype" also.  SO what you want is

Incidents - 3
Assault - 1
Homicide - 1
Sex Crime - 1
Burglary - 0
Kidnapping - 0

The ones with 0 may not show.

mlmcc
incidentbyoffense-1-.rpt
0
 

Author Comment

by:josslmpd
ID: 37758496
What you typed is what I want.  The proposed solution in the attached file doesn't give me that though.  I cannot evaluate based on change of group.  It gives me the total number of incidents, without out any breakdown.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37758748
That is a different issue than the problem we were trying to solve.  It can't be solved with summaries or running totals since they cannot be controlled

See if this is what you want.

This method will work for small numbers of offense types.  If you need more offense types and they might vary then another method will be needed.

mlmcc
incidentbyoffense-1-.rpt
0
 

Author Comment

by:josslmpd
ID: 37758967
I must not have been clear in my original post.  My only issue from the very begining was to get the sub-types totals nothing else.  I didn't think that it could be solved with summaries or running totals, but I wanted to double check.  This report looks the same as the last one, how is it different?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37759055
Attached the wrong one apparently

mlmcc
incidentbyoffense-1-.rpt
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37759069
Still wrong

mlmcc
incidentbyoffense-rev1.rpt
0
 

Author Comment

by:josslmpd
ID: 37759147
Yes!  Thank you.  Could you in general explain what you did?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 37759258
I added 3 formulas to the group header to count the types

WhilePrintingRecords;
Global NumberVar AssaultCount;
If {@Offense Code} = "Assault" then
    AssaultCount := AssaultCount + 1;
""

I then have display formulas
WhilePrintingRecords;
Global NumberVar AssaultCount;
"Assaults : " & CStr(AssaultCount,0)

There is also a DeclareCounters formula that should be in hte report header
WhilePrintingRecords;
Global NumberVar SexAssaultCount;
Global NumberVar AssaultCount;
Global NumberVar HomicideCount;
""

mlmcc
mlmcc
0
 

Author Closing Comment

by:josslmpd
ID: 37759266
thanks for all of the follow up!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

30 Experts available now in Live!

Get 1:1 Help Now