Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula for Time of Admit Post Reply Post New Topic
Author Message
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Topic: Formula for Time of Admit
     Posted: 06 Jul 2015 at 8:38am
Hello,
 
I am wanting to create a formula to capture 3 different shifts by the field admit.admit_time_of  (not 24 hour)
 
I have the following formula:
 
if {admit.admit_time_of} IN '07:01 AM' TO '03:00 PM'
THEN
'Day 7-3'
ELSE
if {admit.admit_time_of} IN '03:01 PM' TO '11:00 PM'
THEN
'Swing 3-11'
ELSE
if {admit.admit_time_of} IN '11:01 PM' TO '07:00 AM'
THEN
'NOC 12-7'
ELSE
'Other Time'
 
Ideally there should not be any records in the Other Time category however I am getting a large number of records under this category.
 
Am i doing something wrong?
 
 
 
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Jul 2015 at 8:48am
what field type is admit.admit_time_of?

evaluating times as strings and seeing what happens in a time span is not a good idea. now it is looking for between a sorted string not time like a clock.
they should be actual time values


if time({admit.admit_time_of}) IN time('07:01) AM' TO time('03:00 PM') ...

Edited by DBlank - 06 Jul 2015 at 8:49am
IP IP Logged
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Posted: 06 Jul 2015 at 8:53am
It is a string
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Jul 2015 at 9:11am
use the TIME() on it as indicted in the second part of my post.
Also make sure to compare it to Time values not strings
IP IP Logged
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Posted: 06 Jul 2015 at 10:17am
Thank you that worked!
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