Author |
Message |
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|
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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
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 Logged |
|
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|
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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
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 Logged |
|
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|
Posted: 28 Mar 2015 at 6:25am |
Dblank, you are genius !!! Thanks again for all your help.
|
IP Logged |
|
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|
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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
Posted: 20 Apr 2015 at 4:44am |
Some sample data from the TeacherOn field please?
|
IP Logged |
|
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|
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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
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 Logged |
|
|