Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Date different Post Reply Post New Topic
Author Message
CrystalGirl
Newbie
Newbie


Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Quote CrystalGirl Replybullet Topic: Date different
    Posted: 26 Mar 2015 at 3:20am
Hi,

I have a field that show the start time of each student. I am developing a report to find out whether a student(s) late or early to start their class. The school start time is 8.00 am.

Here is the start time field: {StudentStartTime}

So, what is the formula so I can the time different for my new field called {LateOREarly} ?

Thank you all
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Mar 2015 at 4:05am
a little vague but I think you want something like
 
 
if time(8,0,0)>= {StudentStartTime} then 'On Time' else
if time(8,0,0) <  {StudentStartTime} then 'Late' else


Edited by DBlank - 26 Mar 2015 at 4:06am
IP IP Logged
CrystalGirl
Newbie
Newbie


Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Quote CrystalGirl Replybullet Posted: 26 Mar 2015 at 3:05pm
Thanks DBlank, that's work. If I want to get how much time a student being late or early? How do I write the formula in Crystal?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Mar 2015 at 7:30am
 {StudentStartTime}  is a time data type field, correct?
one possibility
 
datediff("n",(currentdate+{StudentStartTime}),(currentdate+time(8,0,0)))
IP IP Logged
CrystalGirl
Newbie
Newbie


Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Quote CrystalGirl Replybullet Posted: 28 Mar 2015 at 6:25am
Dblank, you are genius !!! Thanks again for all your help.
IP IP Logged
CrystalGirl
Newbie
Newbie


Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Quote CrystalGirl Replybullet Posted: 18 Apr 2015 at 5:42am
Hi DBlank,

I just run the last formula of datediff("n",(currentdate+{StudentStartTime}),(currentdate+time(8,0,0)))

with different field {TeacherOn} and I got a message saying that "A number is required here" on the {TeacherOn} field. {TeacherOn} field is a String field. Do you know how do I fix this issue so I can get the different time from {TeacherOn} to default 8.00 am?

Edited by CrystalGirl - 18 Apr 2015 at 5:44am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Apr 2015 at 4:44am

Some sample data from the TeacherOn field please?

IP IP Logged
CrystalGirl
Newbie
Newbie


Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
Quote CrystalGirl Replybullet Posted: 20 Apr 2015 at 4:38pm
Hi DBlank..

Here are some samples of data:

08:45:01
09:10:25
11:35:33
15:22:05
 
and so on...

The field data type is String.

Thanks Dblank


Edited by CrystalGirl - 20 Apr 2015 at 6:00pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 21 Apr 2015 at 1:56am
wrap it in the TIME() function to convert it to a time data type.
Time(table.teacheron)
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.