Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal Reports 8.5. Suppressing non consecutive duplicate fields

Posted on 2004-08-04
4
Medium Priority
?
803 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 1000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 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