Print Page | Close Window

How to supress duplicates

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4480
Printed Date: 02 May 2024 at 11:40pm


Topic: How to supress duplicates
Posted By: vijaykbk
Subject: How to supress duplicates
Date Posted: 07 Oct 2008 at 6:47pm
Hi, I getting duplicate rows while developing a report. i am using single table only.
Ex:                                                           Expected:
 ID      Name                                 ID               Name
 01      AAA                                    01              AAA
 02      BBB                                     02             BBB
 01      AAA                                     03             CCC
 03      CCC
 02      BBB
 
In this case how to remove the duplicates, and when i count the rows  it will show only 3,
 
Can you help me how to do this
 
Thanks in Advance
 
Vijay
 
 



Replies:
Posted By: BrianBischof
Date Posted: 08 Oct 2008 at 10:05am
Crystal Reports has a function called PreviousValue() that you can use in the Suppress property to suppress the section when the current value is equal to the previous value. Using your own field name, put this in the Suppress property.
 
{table.fieldname} = PreviousValue({table.fieldname});
 
I have the all the Crystal functions documented with sample code in my Encyclopedia books. You can find out more about my books at http://www.amazon.com/exec/obidos/ASIN/0974953601/bischofsystem-20 - Amazon.com or reading the http://members.crystalreportsbook.com - Crystal Reports eBooks online.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: BrianBischof
Date Posted: 08 Oct 2008 at 10:06am
Oh yeah - for this to work you need to group by ID so that they are ordered next to each other. Otherwise, the PreviousValue() function won't ever have a match.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window