HELP, Paradox 5.0 time calculations 
Author Message
 HELP, Paradox 5.0 time calculations

Hello,

I have posted here a before (several attempts with MSN, but I cannot read
this newsgroup with MSN because of server problems) for the same problem.

I am trying to calculate the difference in time and express the result as
an number.

For example, if a user imputs 8:00 AM for a start time, and 4:15 PM for
an ending time, Paradox should calculate total hours as "8.25"

This calculation is needed to automate a billing charges for a home child
care facility.  The calculation will involve four time options.

Name                --       Example Element
Arrival Time      --          Arrive
School Depart   --          AMDepart
School Arrive    --          PMArrive
Depart Time      --          Depart

A child could come in the morning or afternoon hours only, for the entire
day, or not at all.  

I have tried CALC formulas in Forms, Queries, and Reports, using the
above example elements, but only get results that are less than 1 (i.e.,
0.31, -0.21, etc.).  


Your help is appreciated.

Sincerely,
Daniel A. Lee



Tue, 26 Oct 1999 03:00:00 GMT
 HELP, Paradox 5.0 time calculations


I have a table used to track the hours worked on a shift, there is a begin
and an end field, this code is attached to the depart method of the end field

method depart(var eventInfo MoveEvent)
IF SELF.VALUE>0 THEN
TIME.value=(number((begin-END)*-1)/1000/60/60)  ELSE DODEFAULT
ENDIF
endmethod
TIME is a field on the form.  It is not good practice to store calculated data
however in this case it is necessary for other processes, at least it seemed like
it was when I designed that form, three or four years ago <g>.

Dan

Quote:

>Hello,

>I have posted here a before (several attempts with MSN, but I cannot read
>this newsgroup with MSN because of server problems) for the same problem.

>I am trying to calculate the difference in time and express the result as
>an number.

>For example, if a user imputs 8:00 AM for a start time, and 4:15 PM for
>an ending time, Paradox should calculate total hours as "8.25"

>This calculation is needed to automate a billing charges for a home child
>care facility.  The calculation will involve four time options.

>Name                --       Example Element
>Arrival Time      --          Arrive
>School Depart   --          AMDepart
>School Arrive    --          PMArrive
>Depart Time      --          Depart

>A child could come in the morning or afternoon hours only, for the entire
>day, or not at all.  

>I have tried CALC formulas in Forms, Queries, and Reports, using the
>above example elements, but only get results that are less than 1 (i.e.,
>0.31, -0.21, etc.).  


>Your help is appreciated.

>Sincerely,
>Daniel A. Lee



Tue, 26 Oct 1999 03:00:00 GMT
 HELP, Paradox 5.0 time calculations



Quote:
> For example, if a user imputs 8:00 AM for a start time, and 4:15 PM
> for an ending time, Paradox should calculate total hours as "8.25"

It should be simpler but its not.  You have to calculate the hours and
minutes separately.  Here is a calculation between two time fields that
works correctly whichever time is later.  If there is no possibility
that the times can be interchanged, you can skip the iif() and just use
the second argument in the iif().  Hope this helps.

iif([ECTRFLOW.Arrived]>[ECTRFLOW.Appointment],(hour([ECTRFLOW.Arrived]-[
C
TRFLOW.Appointment]))*60+minute([ECTRFLOW.Arrived]-[ECTRFLOW.Appointment
)
,-((hour([ECTRFLOW.Appointment]-[ECTRFLOW.Arrived]))*60+minute([ECTRFLOW
A ppointment]-[ECTRFLOW.Arrived])))



Wed, 27 Oct 1999 03:00:00 GMT
 HELP, Paradox 5.0 time calculations

Quote:

> Hello,

> I have posted here a before (several attempts with MSN, but I cannot read
> this newsgroup with MSN because of server problems) for the same problem.

> I am trying to calculate the difference in time and express the result as
> an number.

> For example, if a user imputs 8:00 AM for a start time, and 4:15 PM for
> an ending time, Paradox should calculate total hours as "8.25"

You'll have to use OPAL, I think.

var
  t1,t2 Time
  n1 Number
endVar

  t1=Time("8:00:00")
  t2=Time("16:15:00")
  n1=(Number(t2)-Number(t1))/60/60/1000
  if n1<0 then n1=n1+24 endIf

Not too difficult, was it?

Joern



Sat, 30 Oct 1999 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Paradox 5.0 Calculations with Time formats

2. Time Calculations with Paradox 5.0

3. Time Calculations in Paradox 5.0

4. Calculations and rouding pblms Paradox 5.0

5. Time Calculations in Paradox

6. Run-time errors Paradox 5.0

7. Paradox 5.0 Run Time

8. Does Paradox 5.0 has real-time Clock?

9. Paradox for Windows 5.0, Time, & ODAPI

10. Paradox 5.0 Run Time

11. Run time development: dBase for windows or Paradox 5.0 for windows


 
Powered by phpBB® Forum Software