Crystal Reports - Suppress Non-Consecutive Duplicates in Group

I'm working on building a report that pulls name data based on a specific report identification number. I have the information grouped by the report number and want to display names related to the report. The problem is that each report number can/often does have subsequent reports written that are attached to the same number which include the same names, thus giving me duplicate names in the group, but not listed consecutively. The report looks like this currently:

Report #                Name
170001                   Smith, Bob
                                Doe, John
                                Doe, Jane
                                Smith, Bob
                                Doe, John
                                Doe, Jane
170002                   Jones, Mike
170003                   White, James
                                White, Jack
                                White, James

I want to suppress all instances where there are duplicate names under the same report number.

Thanks in advance for any help!
Melisa BAsked:
Who is Participating?
 
mlmccCommented:
Is there a reason you can't sort by the name and make the list easier to produce?

Is there other information on the line or just the names?

You can do this b building an array of names that have been displayed then suppress based on that

Try this idea
In the report header add a formula
Name - DeclareVariables
WhilePrintingRecords;
Global StringVar Array NamesList;
Global NumberVar ListSize;
ListSize := 0;
ReDim NamesList[1];
''

Open in new window


Put the DeclareVariables formula in the Report# Group header also.

In the details section add a formula
Name - BuildandCheckList

WhilePrintingRecords;
Global StringVar Array NamesList;
Global NumberVar ListSize;
Local NumberVar Index;
Local BooleanVar NameFound;
NameFound := False;

For Index := 1 to ListSize do
    If {NameField} = NamesList[Index] then
        NameFound := True;

If NameFound = False then
(
    ListSize := ListSize + 1;
    ReDim Preserve NamesList[ListSize];
    NamesList[ListSize] := {NameFIeld};
)
Else
    ''

Open in new window


In the section expert for the detail section check the box for SUPPRESS BLANK SECTION

mlmcc
1
 
Melisa BAuthor Commented:
The report has the following headers/information:
Report #
Date
Report Type
Location
Make (of Vehicle)
Style (of Vehicle)
Type (for the person listed, this includes codes for the following - suspect, defendant, arrested party)
Name (of the suspect, defendant, arrested party - suspect if they're named, defendant if they're identified in the course of the investigation, arrested party if they're actually arrested for the crime)

The report is grouped by report number so that I avoid duplicates on those - each report can have anywhere from just the original report to several supplemental reports with duplicate information on everything except the actual narrative, so I run into this problem A LOT. The formulas you gave me worked beautifully, but now I can't suppress "blank" sections because of the "Type", since if there are 2 suspects listed, the code shows for each listed suspect name AND the code is there for those blank suspect name fields...so it looks like this:

11111            01/13/17             AUTO THEFT          123 MAIN ST           CHEV/LL        SUS          SMITH,CARL
                                                                                                                                             SUS          SMITH,MARIA
                                                                                                                                             SUS
                                                                                                                                             SUS

because the suspects are listed in both the original and the supplement report. If I suppress duplicates, the code next to MARIA will also disappear, and since there is more than one possible code that could be there, it would create confusion.
0
 
mlmccCommented:
Suppress it using this formula

EvaluateAfter({@BuildandCheckList});
Global StringVar Array NamesList;
Global NumberVar ListSize;
Local NumberVar Index;
Local BooleanVar NameFound;
NameFound := False;

For Index := 1 to ListSize do
    If {NameField} = NamesList[Index] then
        NameFound := True;

NameFound

Open in new window


You can then suppress blank sections

mlmcc
1
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Melisa BAuthor Commented:
Where do I put that one? Sorry, I'm terrible at this.
0
 
mlmccCommented:
In the suppression formula for the object

Right click the object on the report
Click FORMAT OBJECT
Click the COMMON TAB
Click the FORMULA button to the right of suppress

mlmcc
1
 
Melisa BAuthor Commented:
When I put it in the Suppress formula section, the entire column was blank. When I put it in the Suppress if Duplicated formula section, it suppressed the duplicates in each group.
0
 
mlmccCommented:
Try changing the loop to go to ListSize -1

mlmcc
1
 
Melisa BAuthor Commented:
Ahhhhh! You're my new best friend. Thank you best friend!!!! xoxoxoxo
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.