Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula help needed Post Reply Post New Topic
Author Message
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Topic: Formula help needed
     Posted: 11 Mar 2015 at 7:13am

In my report I need to show the date and time of admission.  There is one database field for this titled ch_adm_dt.  I have this field on the report 2 times once as a date field and once as a time field.  The date and time will result for each account the report pulls.  I have created a formula field title Hour that I want to pupulate with a  number for example if the admit time is between 0:00 and 0:59:59 then populate with a 1 for first hour and if it is 11:00 to 11:59 then populate with 12 for the twelth hour and if 23:00 to 23:59:59 then populate with 24 for the twentyfourth hour.  How can I accomplish this?

Acct#  Adm Dt  Adm Tm  Hour
111    3/1/15    0:03        1
222    3/5/15    11:21      12
333    3/6/15    23:59      24
Paula J
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Mar 2015 at 7:42am
datepart('h',table.ch_adm_dt)
 
 
IP IP Logged
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Posted: 11 Mar 2015 at 8:45am
Sorry I don't understand what I need to do with this.  Do I insert it into the report somewhere?
Paula J
IP IP Logged
Paula J
Groupie
Groupie
Avatar

Joined: 22 Aug 2011
Location: United States
Online Status: Offline
Posts: 51
Quote Paula J Replybullet Posted: 11 Mar 2015 at 8:57am
I figured it out and it works...thanks!
Paula J
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