Print Page | Close Window

How to highlight a duplication?

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=14753
Printed Date: 03 May 2024 at 1:57am


Topic: How to highlight a duplication?
Posted By: andyme
Subject: How to highlight a duplication?
Date 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



Replies:
Posted By: DBlank
Date 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.



Posted By: FrnhtGLI
Date 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.



-------------
|< /\ '][' ( )


Posted By: andyme
Date 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?


Posted By: DBlank
Date 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

 


Posted By: andyme
Date 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*


Posted By: FrnhtGLI
Date 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.


-------------
|< /\ '][' ( )


Posted By: FrnhtGLI
Date Posted: 25 Oct 2011 at 4:36am
Can you group them by date?

-------------
|< /\ '][' ( )


Posted By: andyme
Date Posted: 25 Oct 2011 at 4:58am
ive just fixed it YAY! thanks for all of your help.



Print Page | Close Window