Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Birth date issue Post Reply Post New Topic
Author Message
swilleyk
Newbie
Newbie
Avatar

Joined: 25 Oct 2011
Location: United States
Online Status: Offline
Posts: 18
Quote swilleyk Replybullet Topic: Birth date issue
    Posted: 31 May 2012 at 5:34am
I have  report that pulls the birth date for a student, but pulls the date and time. I need to be able to display the report, but just want to display the date and not the time. I have tried

if length(undergrad.birtdate)<39 then {undergrad.birtdate} else

left(undergrad.birtdate,instrrev(left(undergrad.birtdate,39),' ')-1)


but get an error stating expecting string. Not sure where to try next on this. Any help would be appreciated. I need to truncate to 39 characters (which in most situations this would happen automatically, but just trying to cover my a$$ with the formula)


Thanks

Kevin


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 May 2012 at 5:42am
if it is a a datetime field type
just right click on it
select format field
select date time tab
select the date display type you want fromt he list (or customize)
 
if it is a string you can convert it to a date field as
todate(table.field)
IP IP Logged
swilleyk
Newbie
Newbie
Avatar

Joined: 25 Oct 2011
Location: United States
Online Status: Offline
Posts: 18
Quote swilleyk Replybullet Posted: 31 May 2012 at 5:50am
That works great for showing in the report, but I have a report "header" piece that has the birth date filed as part of a formula that I can not edit like this. I need to just display that date format as part of the formula. Here is the entire formula for reference

"|"&"Admissions"&"|"&{ContactExtensionBase.Datatel_erpid}&"|"&{@lastnametrunc}&"|"&{@firstmiddletrunc}&"|"&{datatel_undergraduateapplicationforadmissionExtensionBase.Datatel_birthdate}&"|"&{datatel_undergraduateapplicationforadmissionExtensionBase.H17_AreyouaUSCitizen}&"|"&{@counselortrunc}&"|"&{@termidformtrunc}&"||"&"App -"&" "&{@admittypeformtrunc}&" "&{@decisionplanformtrunc}&"|"

It is being used by a separate program for indexing purposes.  DOB is in red.

Thanks
Kevin
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 May 2012 at 7:59am
so it appears it is a string type
you can convert to a date and then back to a string with formatting rule on it
totext(date(field),"MM/dd/yyyy")
IP IP Logged
swilleyk
Newbie
Newbie
Avatar

Joined: 25 Oct 2011
Location: United States
Online Status: Offline
Posts: 18
Quote swilleyk Replybullet Posted: 31 May 2012 at 8:31am
Thanks - exactly what I was looking for.
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.016 seconds.