Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Adding to the date Post Reply Post New Topic
Author Message
impalacrazy
Newbie
Newbie
Avatar

Joined: 21 Jul 2008
Location: United States
Online Status: Offline
Posts: 7
Quote impalacrazy Replybullet Topic: Adding to the date
    Posted: 05 Aug 2008 at 11:33am
So i have raw file that has one date field, My crystal takes that date and addes two time fields to if from that file. i then have two fields the derive from the same date field, however the time in the fields is what is the difference (i.e. DOS = 3/14/08 23:23pm & Triage = 3/14/08 00:10am)
 
now triage should be read as 3/15/08 00:10am as it is the next day. I am trying to compare the hour and add to the date in my code below. Can any help and let me know what i may be doing wrong.
 
 
If Time(hour({@Arrival Date})) > Time(hour({@Triage time}))  then
    date(day({@Triage time}), day({@Triage time}), 1)+1
else
    {@Triage time}
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 05 Aug 2008 at 12:43pm
The problem is here:
 
 date(day({@Triage time}), day({@Triage time}), 1)+1
 
Should be:
 
{@Triage time} + 1
 
-Dell
IP IP Logged
impalacrazy
Newbie
Newbie
Avatar

Joined: 21 Jul 2008
Location: United States
Online Status: Offline
Posts: 7
Quote impalacrazy Replybullet Posted: 05 Aug 2008 at 12:50pm
So your saying i should take out the:
 
date(day({@Triage time}), day({@Triage time}), 1)+1
 
and replace the whole line with:
 
{@Triage time} + 1
 
I tried that and now no dates show up in the field.
 
Thanks for your help by the way =)
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 05 Aug 2008 at 12:59pm

Let's try simplifying it a little further...  Try this:

 
If hour({@Arrival Date}) > hour({@Triage Time}) then
  {@Triage Time} + 1
else
  {@Triage Time}
 
Since the Hour function returns a number and you're using a 24-hour time, you don't need to convert it back to Time.
 
If that doesn't work, try breaking it down into pieces in multiple formulas to determine what the data actually looks like - for example, make each of these lines a separate formula and put them on your report just to see what the values are:
 
Hour({@Arrival Date})
Hour({@Triage Time})
{@Triage Time} + 1
 
From there, you should be able to determine what's wrong with your formula.
 
-Dell
IP IP Logged
impalacrazy
Newbie
Newbie
Avatar

Joined: 21 Jul 2008
Location: United States
Online Status: Offline
Posts: 7
Quote impalacrazy Replybullet Posted: 05 Aug 2008 at 1:33pm
Thanks splitting it up let me see the format on one field was not military so it wasnt calulating correclty. i appreciate all your help.
 
 Wink
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.035 seconds.