Print Page | Close Window

HELP I need a formula for a time duration

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3995
Printed Date: 17 May 2024 at 10:16pm


Topic: HELP I need a formula for a time duration
Posted By: fairy princess
Subject: HELP I need a formula for a time duration
Date Posted: 15 Aug 2008 at 5:05am
  PLease can anyone help me i need a formula for a time duration
 
vrAttendance.SeenTime  vrAttendance.FinishTime to give a duration
 
For give me for not knowing as i is blonde
Please can anyone help me
 
Many Thanks XX


-------------
Many Thanks the tooth fairy



Replies:
Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 5:19am
Hi,
 
Can you post some sample data for
 
Seentime    Finishtime
 
does these fields have date in them or just time?
 
Cheers
Rahul


Posted By: fairy princess
Date Posted: 15 Aug 2008 at 7:00am
  hi
Attendance Date                   Seentime    Finishtime  
   01/05/2007                           09.00           09.55    
 
many thanks
xx


-------------
Many Thanks the tooth fairy


Posted By: fairy princess
Date Posted: 15 Aug 2008 at 7:01am
  it has time attentance is date

-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 7:11am

Hi

Create a formula as

Frm_TimeDiff

and enter the code below

vrAttendance.FinishTime -vrAttendance.SeenTime 

Once done place the formula in details section next to finishtime
 
output 0.55
 
Cheers
Rahul


Posted By: fairy princess
Date Posted: 15 Aug 2008 at 7:22am
hi
I went to formula fields
right click , new
call Frm_TimeDiff
entered code
it says
 
 
a number curreny date is needed
Help i so lost


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 7:57am
Hi
 
use the code below
 

tonumber({vrAttendance.FinishTime}) - tonumber({vrAttendance.SeenTime} )

 
will work let me know
 
cheers
rahul


Posted By: fairy princess
Date Posted: 15 Aug 2008 at 8:04am

hi

i used the code and i check its was ok . place it in details
in pop up error message The string is non-numeric
 
i do hope u can help xxx
 


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 8:10am
--


Posted By: fairy princess
Date Posted: 15 Aug 2008 at 8:16am
hi
seentime :string      Finishtime:string   (lenght5)
 
i usin crystal reports 10
and using ODBC(RDO) data base


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 8:20am
Hi
 
 
try this
 
 
if     isnumeric({vrAttendance.FinishTime})
and isnumeric({vrAttendance.SeenTime}) then
tonumber({vrAttendance.FinishTime})- tonumber({vrAttendance.SeenTime})
else
0.00
 
I think some values in finishtime or seentime are nulls or spaces.
 
let me know if the above code works if not please do the following 
 
Ok can you post me some more sample records,does all records have
values in them,what database are you using.
 
Cheers
Rahul


Posted By: fairy princess
Date Posted: 15 Aug 2008 at 8:26am
hi u try gent
all i gettin is a 0.00 value
xx


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 15 Aug 2008 at 8:29am
Ok
 
Some more sample data please...........
 
cheers
Rahul


Posted By: rahulwalawalkar
Date Posted: 18 Aug 2008 at 7:34am
Hi,
Did u manage to resolve the issue?
cheers
Rahul


Posted By: fairy princess
Date Posted: 19 Aug 2008 at 12:49am

Hi

Have not sorted out the prob when i run it it just gives me 0.00 in return
 
 
{vrAttendance.AttendanceType} in ["Follow-up (Old)", "New Patient", "Rebook Patient"] and
{vrAttendance.SeenTime} in "09.00" to "16.00" and
{vrEpisode.Location} = "QEQM -THANET" and
{vrAttendance.AttendanceDate} in DateTime (2008, 06, 01, 00, 00, 00) to DateTime (2008, 06, 07, 00, 00, 00)
 
seentime & finishtime is  string
Many Thanks For your Help


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 19 Aug 2008 at 1:10am
Hi,
 
Are you getting records for the selection below .also you are checking for Seetime in "09.00" to "16.00" do you also need to check Finish Time?
 
Can you post the output sample records that you are getting for selection below.
 
Cheers
Rahul


Posted By: fairy princess
Date Posted: 19 Aug 2008 at 3:58am
HI
 
Attendance Date          SeenTime      FinishTime             Time Difference
 
     jun-08                        09.00               09.25                    0.00
 
this is the outcome


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 19 Aug 2008 at 4:50am
That seems strange ,what database are you using
 
Access
Sql Server
Oracle.
 
Cheers
Rahul


Posted By: fairy princess
Date Posted: 19 Aug 2008 at 4:56am
Sql Server
ODBC (RDO)

-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 19 Aug 2008 at 5:07am
That is very strange
 
I have created a test table in Sql Server 2000 and this is the data
using ODBC(RDO) i am getting the results below the formula is same as posted before
 
 
SeenTime  FinishTime  frm_time
09.00        16.00          7.00
12.00        13.00         1.00
08.45         09.12        0.67
                  0.19          0.00
09.00         09.25        0.25
 
Confused 
 
what if you remove all the filters do you still get 0.00 do one thing comment out the entire record selection formula and let me know
 
can you paste few more records.
 
Thanks
Rahul


Posted By: fairy princess
Date Posted: 19 Aug 2008 at 5:37am

i created a new formula called it Frm-time and  use Expert 

and pasted in the formula you said and all it does is give me zeros. i must be doing something wrong but not sure what  



-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 19 Aug 2008 at 5:42am
Hi,
 
Can you mail me the report with the output..........i need to have a look.....
 
mailto:rahulwalawalkar@yahoo.com - rahulwalawalkar@yahoo.com
 
cheers
Rahul


Posted By: fairy princess
Date Posted: 19 Aug 2008 at 6:56am
i have not created a
custom function
will i need to


-------------
Many Thanks the tooth fairy


Posted By: rahulwalawalkar
Date Posted: 19 Aug 2008 at 7:32am
 
Hi
 
custom function for what???
 
you just need to open the report then in file menu select Save Data with Report  run the report save it and email me .
 
Cheers
Rahul



Print Page | Close Window