Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: How to highlight a duplication? Post Reply Post New Topic
Author Message
andyme
Newbie
Newbie
Avatar

Joined: 19 Feb 2010
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote andyme Replybullet Topic: How to highlight a duplication?
    Posted: 24 Oct 2011 at 5:32am
I have a list of about 200 members of staff login records for the last 3 months sorted into date order under the each staffs name.

e.g.

John Smith
01/04/2011 09:00AM
02/04/2011 09:00AM
04/04/2011 09:00AM
04/04/2011 13:00PM
05/04/2011 09:00AM
06/04/2011 10:00AM
09/04/2011 09:00AM
09/04/2011 09:30AM

to make easier to faster to find the duplications on the dates is their anyway you can highlight them? tried using the highlight expert but its not technical enough and google isnt much help.

Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Oct 2011 at 5:54am
i doubt this is what you will like as it highlights a lot of rows and grouping on the date set to day would likely get you more what you want but if you just want the field highlighted then...
right click on the field
select format field
select border tab
select bakground formula box (x-2) and add your highlight formula here
if datediff('d',previous({table.DATE}),{table.DATE})=0 then cryellow else crnocolor
 
 

Edited: as an FYI i opted to use the datediff() function here because you appear to have a datetime field and you wanted to highlight when the day changes regardless of the time.



Edited by DBlank - 24 Oct 2011 at 6:27am
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 24 Oct 2011 at 6:00am
Right-click on the field and click Format Field. In the Border tab check the Background box and click the Formula Editor for the Background (X-2). The formula should be something like:
if {field.date}=previous({field.date})
     then crRed
          else crNoColor



!!EDIT!!
Added parenthesis as DBlank pointed out.



Edited by FrnhtGLI - 25 Oct 2011 at 4:00am
|< /\ '][' ( )
IP IP Logged
andyme
Newbie
Newbie
Avatar

Joined: 19 Feb 2010
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote andyme Replybullet Posted: 24 Oct 2011 at 10:50pm
Cheers for this, I tried the code but I get prompt with this error message when trying to run the report "The keyword 'Then' is missing."(probably something daft) any ideas?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Oct 2011 at 3:36am
you are using FrnhtGLI's code, correct?
it needs parenths around the previous function
if {field.date}=previous({field.date})
     then crRed
          else crNoColor

 
IP IP Logged
andyme
Newbie
Newbie
Avatar

Joined: 19 Feb 2010
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote andyme Replybullet Posted: 25 Oct 2011 at 3:57am
It kinda worked, it highlighted the field if the previous field was the same, but if 2nd previous field is the same date it just passes by. e.g.

01/04/2011 09:00AM
02/04/2011 09:00AM
04/04/2011 09:00AM
04/04/2011 13:00PM
*09/04/2011 09:00AM*
05/04/2011 09:00AM
06/04/2011 10:00AM
*09/04/2011 09:30AM*
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 25 Oct 2011 at 3:58am
Whoops! Sorry about that.

I should note that my code was not assuming that it was a DateTime field, so you might want to try DBlank's suggestion as his accounts for this.
|< /\ '][' ( )
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 25 Oct 2011 at 4:36am
Can you group them by date?
|< /\ '][' ( )
IP IP Logged
andyme
Newbie
Newbie
Avatar

Joined: 19 Feb 2010
Location: United Kingdom
Online Status: Offline
Posts: 15
Quote andyme Replybullet Posted: 25 Oct 2011 at 4:58am
ive just fixed it YAY! thanks for all of your help.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.