Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Filtering Duplicate record based on one field Post Reply Post New Topic
Author Message
manish_mau
Newbie
Newbie


Joined: 29 Jul 2009
Online Status: Offline
Posts: 3
Quote manish_mau Replybullet Topic: Filtering Duplicate record based on one field
     Posted: 29 Jul 2009 at 8:15am
I am using BOXI and  have record coming in detail section something like

STU1 , ABC , 200, ---------------------------------
STU2 , DEF , 300, ---------------------------------
STU1 , GHI,  400, ---------------------------------
STU3 , KIL , 400, ---------------------------------

I want to ignore the record if the first field is duplicate. In above example STU1 is coming again in 3rd record, so 3rd record must be removed.

I have tried using many thing like supress and all but problem is that if supress the record still it will appear if the group by is done on the records.

Is there something like if Previous (COL1) = COL1 then delete record.
If yes please help me to know the formula and where should i put it.

Thanks in advance.





IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Jul 2009 at 9:37am
Can you set up a group on the first field in the report?  If so, put the data in the group header section instead of in the details section to show only the first record.
 
-Dell
IP IP Logged
manish_mau
Newbie
Newbie


Joined: 29 Jul 2009
Online Status: Offline
Posts: 3
Quote manish_mau Replybullet Posted: 29 Jul 2009 at 10:02am
Thanks. Actually my report is grouping by the filtered record.

Step 1 - Getting all the record
-----------------------

STU1 , ABC , 200, ---------------------------------
STU2 , DEF , 300, ---------------------------------
STU1 , GHI,  400, ---------------------------------
STU3 , KIL , 400, --------------------------------- 

Step 2 - Filtering the duplicate one out

STU1 , ABC , 200, ---------------------------------
STU2 , DEF , 300, ---------------------------------
STU3 , KIL , 400, ---------------------------------

Step 3 - Get the Sum of amount grouped by COL2

STU1 , ABC , 200, ---------------------------------
STU2 , DEF , 300, ---------------------------------
STU3 , KIL , 400, ---------------------------------

So if you see here when I will do grouping in Step3 , I cannot group on the record returned by Step 2.  Or can I ? . If yes , please let me know how can I do that.

In SQL i could have done that by

select COL2, SUM(COL3) from
(select MAX(COL2) ,MAX(COL3) from TABLE1 group by STU1) A
group by COL2

Please let me know how can I implement in Crystal report.

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Jul 2009 at 10:08am

Depending on your database, you should be able to use a Command instead of the tables.  Commands are the SQL that gets all of the data for the report.  If you include fields so that you can link them, you can use more than one Command.  However, if you use Commands, you can't use SQL Expression objects.

 
-Dell
IP IP Logged
manish_mau
Newbie
Newbie


Joined: 29 Jul 2009
Online Status: Offline
Posts: 3
Quote manish_mau Replybullet Posted: 29 Jul 2009 at 10:21am
Problem is that I cannot use Command Object because I am use BO universe as data source. So there no possibility to make any change there.

Whatever is to be done has to be in report processing.I am surprised that Crystal has no such feature as of record filtering based on field value comparison of current and previous record.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 29 Jul 2009 at 11:12am
You can do suppress, but not filtering.
 
However, you can create a formula like this:
 
if {table.col2} = previous({table.col2}) then 0 else {table.col3}
 
You would then do a sum of the formula instead of the field.
 
-Dell
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum