Suppress Duplicate Records Crystal Reports

Posted on 2011-02-28
Last Modified: 2012-05-11

I have a sub-report that has 4 formulas and want to suppress a record if it is duplicated.  For example this is one of the formulas:
if  {ACC_REPORT_DP_S.FLAG_RANGE} = "H" then "H:High"
else if {ACC_REPORT_DP_S.FLAG_RANGE} = "L" then "L:Low"
else if {ACC_REPORT_DP_S.FLAG_RANGE} = "HP" then "HP:High Panic"
else if {ACC_REPORT_DP_S.FLAG_RANGE} = "LP" then "LP:Low Panic"

When the report is run it can display H: High many times I only want to display it once.  Is there a way to suppress duplicate records when using a formula/

Any help is greatly appreciated.

Question by:nobile00
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
  • 5
  • 4
LVL 12

Expert Comment

ID: 34997495
There are a couple ways, depending on what you're trying to accomplish.  One is to create a running total that counts details, and suppresses when the counter is > 1 and {ACC_REPORT_DP_S.FLAG_RANGE} = "H".  Another way is to group by {ACC_REPORT_DP_S.FLAG_RANGE}, and only print the group header, not the details.

Author Comment

ID: 34997539
I tried grouping but that didn't work.  There are 4 formulas that have the same type formula but are coming from 4 different fields in the database.  The other formulas are for flag too.  Would I be able to use a counter with the 4 formulas?
LVL 12

Expert Comment

ID: 34997555
Most likely.  What does those formulas look like?
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.


Author Comment

ID: 34997608
Here are the other 3 formulas:

1. if {ACC_REPORT_DP_S.FLAG_ALERT} = "A" then "A:Alert"
2. if {ACC_REPORT_DP_S.FLAG_EXCLUSION} = "E" then "E:Exclusion"
3. if {ACC_REPORT_DP_S.FLAG_DELTA} = "Dp+" then "Dp+: Positive Delta from Previous Visit"
else if {ACC_REPORT_DP_S.FLAG_DELTA} = "Dp-" then "Dp-: Negative Delta from Previous Visit"
else if {ACC_REPORT_DP_S.FLAG_DELTA} = "Db+" then "Db+: Positive Delta from Baseline"
else if {ACC_REPORT_DP_S.FLAG_DELTA} =  "Db-" then "Db-: Negative Delta from Baseline"
else if {ACC_REPORT_DP_S.FLAG_DELTA} = "Dbp+" then "Dbp+: Postive Delta from Baseline and Previous"
else if {ACC_REPORT_DP_S.FLAG_DELTA} = "Dbp-" then "Dbp-: Negative Delta from Baseline and Previous"
else if {ACC_REPORT_DP_S.FLAG_DELTA} = "Db+Dp-" then "Db+Dp-: Positive Delta from Baseline and Negative Delta from Previous"
else if {ACC_REPORT_DP_S.FLAG_DELTA} = "Db-Dp+" then "Db-Dp+: Negative Delta from Baseline and Positive Delta from Previous"

LVL 12

Expert Comment

ID: 34997853
Those are vanilla formulas, they won't interfere with anything.   Make a simple running total that counts occurrences of any field in the detail record, then in the detail sections suppression formula put '{#myrunningtotal} > 1 and {ACC_REPORT_DP_S.FLAG_RANGE} = "H"'.  Just be sure to reset the running total at an appropriate sort break.

Author Comment

ID: 34997984
Also, there can be duplicates for any of the records not just High it could have multiples of Low LowPanic etc. I not sure the above will work I will give it a try.
LVL 12

Accepted Solution

JayConverse earned 500 total points
ID: 34998062
Then you could have four formulas like this:

HCount: if {ACC_REPORT_DP_S.FLAG_RANGE} = "H" then 1 else 0;
LCount: if {ACC_REPORT_DP_S.FLAG_RANGE} = "L" then 1 else 0;
LPCount: if {ACC_REPORT_DP_S.FLAG_RANGE} = "LP" then 1 else 0;
HPCount: if {ACC_REPORT_DP_S.FLAG_RANGE} = "HP" then 1 else 0;

Then create 4 running totals that sum each of the Count fields.  Then your suppression formula would be more like:

{#myrunningHtotal} > 1 or {#myrunningLtotal} > 1 or {#myrunningLPtotal} > 1 or {#myrunningHPtotal} > 1
LVL 101

Expert Comment

ID: 34998444
Is this for the entire report or do you have the data grouped in some way?

Are you suppressing just the display of that value or the display of the entire record based on 1 or more fields?


Author Comment

ID: 34999083
Thanks for checking in MLMCC the above solution from Jay worked.  

Author Closing Comment

ID: 34999089
Jay this worked a little bit tedious but overall it worked.


Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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 …
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 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