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!

Dummy Group Name

Status
Not open for further replies.

kskid

Technical User
Mar 21, 2003
1,767
US
I am creating a monthly report summarizing the cases handled by investigation by type of incident. I want to standardize the report and show all groups. While it easy enough to summarize what is there, how can I show the group name of those types of incidents where I had no hits?

For example, in the following, how do I show Embezzlement with 0 since I had no embezzlement incidents reported that month.

Type Count

Burglary 23
Larceny 22
Shoplifting 10
Embezzlement 0
Fraud 5

Total 60
 
Assuming you have a table listing Types (otherwise, create it), use an OUTER JOIN from that table to the rest of the information.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I forgot to mention that I can view the tables only but cannot create any, temp or otherwise.

Looks like I'll have to resort to subreports for each group
 
hopefully you have not over simplified your report

You might be able to do it this way

Create an initialization array formula in the report header or main report header if this is repeated

//@Initialization (suppressed in the report Header

StringVar array InvestigationTypes := ["Burglary","Larceny","Shoplifting","Embezzlement","Fraud"];
StringVar array ReportedInvestigations := ["","","","",""];
numberVar Pointer := 0;

In the Investigation Types Group header place the following formula

//@reportedInvestigations (suppressed in header)

WhilePrintingRecords;
StringVar array ReportedInvestigations;
numberVar Pointer;

if not inRepeatedGroupHeader then
(
Pointer := Pointer + 1;
ReportedInvestigations[Pointer] := {table.InvestigationType);
);

Now In the Investigation Types Group footer place the following formula


//@Display_NoIncidents (placed directly under the detail values)

WhilePrintingRecords;
StringVar array InvestigationTypes ;
StringVar array ReportedInvestigations;
StringVar result := "";
numberVar i;

for i := 1 to ubound(InvestigationTypes) do
(
if not(InvestigationTypes in ReportedInvestigations then
result := result + InvestigationTypes + " = 0" + chr(13) + chr(10);
);

result;


Make sure this last formula has "Can Grow" enabled.

this should work




Jim Broadbent
 
ooooppps....typo in the last formula

//@Display_NoIncidents (placed directly under the detail values)

WhilePrintingRecords;
StringVar array InvestigationTypes ;
StringVar array ReportedInvestigations;
StringVar result := "";
numberVar icount;

for icount := 1 to ubound(InvestigationTypes) do
(
if not(InvestigationTypes[icount] in ReportedInvestigations) then
result := result + InvestigationTypes[icount] + " = 0" + chr(13) + chr(10);
);

result;

sorry about that



Jim Broadbent
 
Here's what I have. While it's not exactly like my original question, what I want still holds true.

I assign a group name to each of my offense code reported on each incident in the detail section, which I have suppressed since I only need summary information.

if {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["0310","0311","0320","0321","0330","0331","0340","0341","0350","0351","0360","0361","0370","0371","0380","0381","0382","0383"]
THEN "Robbery"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} like "051*"
THEN "Burglary Res"
ELSE if {OFFENSES.OFFNS_CD_OFFENSE_CODE} like "053*"
then "Burglary Non-Res"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} like "058*"
THEN "Burglary Vehicle"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["620A","620B","620T","621"]
THEN "Larceny Auto Acc"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["630A","630B","631"]
THEN "Larceny Auto"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["640A","640B","641"]
THEN "Larceny ShopLift"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["650A","650B","651","660A","660B","661","670A","670B","671"]
THEN "Larceny Persons"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["610A","610B","611","680A","680B","681","682A","682B","683","684A","684B","685"]
THEN "Larceny Property"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} = "0720"
THEN "Auto Theft"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["0910","0920","0930","0990"]
THEN "Forgery"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["1010","1020"]
THEN "Embezzle"
ELSE IF {OFFENSES.OFFNS_CD_OFFENSE_CODE} IN ["1030","1040","1050","1090"]
THEN "Fraud"
ELSE "0-" + {OFFENSES.OFFNS_CD_OFFENSE_CODE}


From there I just inserted a Group 1 summary on the group name in specified order and that's where I noticed that some of the groups were missing.




 
The output you showed originally could be generated by a set of running totals, counting for each of the categories, and printing the results in Report Footer. This could be done as well as Group, or instead of Group if you have no need to show the individual members.

Madawc Williams
East Anglia, Great Britain
 
Maybe I can convince the management team that if a group is not listed, then no activity occurred that month. It sure would be a lot easier than to show a bunch of zeroes just for the sake of aesthetics.
 
Ooops. I forgot to mention that I do additional running subtotals that include cases assigned, cases cleared, cases cleared by arrest, cases reclassified, cases closed, cases cleared by lack of proof, and percent of cases cleared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top