Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Day of the Week formula Post Reply Post New Topic
Author Message
Kathleen
Newbie
Newbie
Avatar

Joined: 31 Dec 2007
Location: United States
Online Status: Offline
Posts: 17
Quote Kathleen Replybullet Topic: Day of the Week formula
    Posted: 09 Jun 2009 at 12:00pm

I am trying to use the day of the week function to get a date to be represented as only the day of the week it occurred on.

Meaning, {mederror.errordate} equals 06/09/09
I would like the formula to print "TUESDAY"
 
I cannot make this work, I'm not sure if our dates aren't set up as "dates" or what, can someone help me out with this?
 
Thanks in advance
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Jun 2009 at 2:29pm
WeekdayName(Weekday({mederror.errordate}))
or if that is not a date field try
WeekdayName(Weekday(cdate({mederror.errordate})))
IP IP Logged
Kathleen
Newbie
Newbie
Avatar

Joined: 31 Dec 2007
Location: United States
Online Status: Offline
Posts: 17
Quote Kathleen Replybullet Posted: 10 Jun 2009 at 9:09am
I have now tried WEEKDAYNAME(Weekday({mederror.errordate}))) and received the error stating that a date must be here (where the {} field is.
 
I have also tried WEEKDAYNAME(Weekday(cdate({mederror.errordate}))) and I receive bad format or string name.
 
Are there any other suggestions?
 
I guess this may take using two different formulas - first putting the date into a proper date format (I don't know how to do that) and then moving that new created field into one of the formulas above??
 
Does that sound doable?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Jun 2009 at 9:42am

couple of questions to tease this out.

1. In your field explorer, what data type is listed next to the mederror.errordate field?
2. Can you post some sample data that is actually from the field ... especially if there is ever instances that use an alpha character.


Edited by DBlank - 10 Jun 2009 at 9:42am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 15 Jun 2009 at 7:10am
Hi
 
You can try this in your formula to test what records don't have the date format which is expected by cdate function....
 
If IsDate({mederror.errordate}) Then
WEEKDAYNAME(Weekday(cdate({mederror.errordate})))
else
currentdate
 
cdate is bit picky in the format it accepts the date...
 
cheers
Rahul
 
P.S. Different checks you can include in the formula.....
 
IF IsNull({mederror.errordate}) or Trim({mederror.errordate}) = ""
 
totext({mederror.errordate},'dd/MM/yyyy')
 


Edited by rahulwalawalkar - 15 Jun 2009 at 7:13am
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.