Solved

Crystal Reports 8.5. Suppressing non consecutive duplicate fields

Posted on 2004-08-04
4
801 Views
Last Modified: 2009-07-29
How do i suppress duplicates within a report if those duplicates are not consecutivly listed. (for consecutively listed reports I can use either the suppress duplicates checkbox for the field or use a Previous field formula.
E.g. Report with 3 fields    A          B          C    
    Brings back                  (A1)     (B1)      (C1)
                                      (A1)     (B1)       (C2)
                                      (A1)     (B1)       (C3)
                                      (A1)     (B2)       (C1)
                                      (A1)     (B2)       (C4)
                                      (A2)     (B3)       (C1)
                                      (A2)     (B2)        (C3)
I would like to only display each return once so that report above looks like
                                      A          B          C    
    Brings back                  (A1)     (B1)      (C1)
                                                              (C2)
                                                              (C3)
                                                 (B2)      
                                                               (C4)
                                      (A2)     (B3)        
                                               
Can I achieve this witha suppress field formula?
0
Comment
Question by:saylaugh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 250 total points
ID: 11722542
You can probably do it, but it'll be messy.  I don't have access to Crystal at the moment so some syntax may be off but basically you want to write a formula that's really a mini-program...

//@InitFormula  <- Place in report header
shared numberVar NumDistinct := 0;
shared numberVar array FieldAList[100];   <- Assumes field A is numeric, use appropriate data type

//@SuppressFormula  <- Use to conditionally suppress field A.
numberVar i;
booleanVar DupEntry := false;
if shared numberVar NumDistinct = 0 then
(
   shared numberVar array FieldAList[1] := {table.fieldA}
   NumDistinct := 1;  
)
else
(
   for i = 1 to NumDistinct
   (
      if shared numberVar array FieldAList[i] = {table.fieldA} then DupEntry := true;
   )
   NumDistinct := NumDistinct + 1;
   FieldAList[NumDistinct] := {table.fieldA};
)
DupEntry;

Follow the same process for the other two fields and you should have them suppressed - as I said, it's messy...

frodoman
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 11722836
Do you need the format as shown or will something like this work?

      A          B          C    
    (A1)     (B1)      (C1)
    (A2)     (B2)      (C2)
               (B3)       (C3)
                            (C4)

If so you could use subreports for each column and use the Select Distinct capability or suppress duplicate records.

mlmcc
0
 
LVL 42

Expert Comment

by:frodoman
ID: 11725520
Also I didn't ask about your data source.  I believe the absolute best method would be to use a stored procedure and filter out the unnecessary date before it even gets to Crystal.

If you're already using a SP or have the option of doing so then I'd advise taking this route.

frodoman
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 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