Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Dateadd and date selection Post Reply Post New Topic
Author Message
nlcdcg
Newbie
Newbie


Joined: 24 Nov 2011
Online Status: Offline
Posts: 10
Quote nlcdcg Replybullet Topic: Dateadd and date selection
     Posted: 17 Feb 2012 at 1:21am
Hi,
Please can someone help me with the below?  I have a current date field in epoch time which I need to convert to display in a Crystal report.  I have done that using:
 
DateAdd ("s", {emm_Image.backuptime}, #1/1/1970# )
 
which works fine.  This field is then used in a cross tab report and displays every date entry.  However I want the cross tab to only display dates which are a Friday, not all the dates recorded.
 
Does anyone know how to do this?
 
Thanks in advance.
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 17 Feb 2012 at 6:36am
try adding
dayofweek({emm_Image.backuptime}) = 5
to your formula
IP IP Logged
nlcdcg
Newbie
Newbie


Joined: 24 Nov 2011
Online Status: Offline
Posts: 10
Quote nlcdcg Replybullet Posted: 17 Feb 2012 at 9:56am

Hi,

I have added it to my string so it looks like this:
 
DateAdd ("s", {emm_Image.backuptime}, #1/1/1970# ( dayofweek({emm_Image.backuptime}) = 5))
 
but I am getting an error saying the ) is missing.  Please can you give me the whole string - sorry, scripting is not my strong point...
 
Thanks in advance.
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 17 Feb 2012 at 9:59am
you place this
dayofweek({emm_Image.backuptime}) = 5
into your select expert
IP IP Logged
nlcdcg
Newbie
Newbie


Joined: 24 Nov 2011
Online Status: Offline
Posts: 10
Quote nlcdcg Replybullet Posted: 17 Feb 2012 at 10:11am
My record select formula is currently:
 
{@backuptime} in {?Start Date} to {?End Date}
 
so I can specify a date range.
 
How do I add that to the above?  Sorry, as you can tell this is not my strong point....
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 17 Feb 2012 at 10:15am
{@backuptime} in {?Start Date} to {?End Date}and
dayofweek({emm_Image.backuptime}) = 5
IP IP Logged
nlcdcg
Newbie
Newbie


Joined: 24 Nov 2011
Online Status: Offline
Posts: 10
Quote nlcdcg Replybullet Posted: 17 Feb 2012 at 10:24am

Brilliant!  Thank you so much!!  Clap

emm_image.backuptime is in epoch time and errored saying 'a date is required here' so I changed it to:
 
 {@backuptime} in {?Start Date} to {?End Date} and
dayofweek({@backuptime}) = 5
 
which works perfectly.... Smile
 
 


Edited by nlcdcg - 17 Feb 2012 at 10:25am
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