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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.