Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem displaying times over midnight

Status
Not open for further replies.

bj1

MIS
Nov 11, 2002
53
AU
hi all,

this is what i want to achieve:

(Location) (From) (To) (Visit Length)
1/5/03
XXXXXX 00:00 07:30 07:30
XXXXXX 08:16 17:31 09:15
XXXXXX 18:02 00:00 05:58

2/5/03
XXXXXX 00:00 07:00 07:00
XXXXXX 08:37 17:31 08:54
ETC.....

this is what i am getting:

(Location) (From) (To) (Visit Length)
1/5/03
XXXXXX 08:16 17:31 09:15
XXXXXX 18:02 00:00 05:58

2/5/03
XXXXXX 08:37 17:31 08:54

As you can see, midnight to the next morning isn't showing up...

The formulas i am using are:

@SetStartTime :

whileprintingrecords;
global datetimevar StartTime;

local timevar send_time := {?Shift End Time};
if ( send_time = time(0,0,0) ) then
send_time := time(23,59,59);

if ( OnLastRecord ) then
StartTime := datetime(date({@LocalGPSDATETIME}),send_time)
else if ( date({@LocalGPSDATETIME}) <> date({@LocalTimeNext}) ) then
StartTime := datetime(date({@LocalGPSDATETIME}),send_time)
else if ( {journey_events.LOC_ID} <> next({journey_events.LOC_ID}) ) then
StartTime:={@LocalGPSDATETIME};

StartTime;


@SetStopTime :

whileprintingrecords;
global datetimevar StopTime;
global datetimevar StartTime;

if ( OnFirstRecord )
or ( date({@LocalGPSDATETIME}) <> date({@LocalTimePrev}) )
or ( {journey_events.LOC_ID} <> previous({journey_events.LOC_ID}) ) then
(
StopTime:= {@LocalGPSDATETIME};
StartTime := StopTime;
);

StopTime;


Let me know if you need any more info on other formula's etc.

Thanks,
B
 
Instead of complex logic within variables, why not a formula field using the DateAdd function, which adds or subtracts either dates or datetimes?

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top