The formula below works most of the time, but occasionally I get a Bad date-time string format. I believe it only happens when {@SignOff} = 0, but I'm not sure how to handle that in the formula. I'm looking for a way to add something like if {@SignOff} = 0 then 0 else 'rest of formula'. I'm not sure how to go about this in Basic Syntax. Here is the current formula:
WhilePrintingRecords
global mtime As DateTime
Dim sONt As DateTime
Dim sOFFt As DateTime
sOFFt = DateTimeValue ({@SignOff})
if NextIsNull ({Reason Code Events.Time Stamp}) then
formula = HrsMinsSecs( DateTimeToSeconds (sOFFt) - DateTimeToSeconds(mtime))
else
sONt = DateTimeValue ({@SignOn})
if {Reason Code Desc.Reason Code Description} <> "SIGN OFF - END OF SHIFT" then
formula = HrsMinsSecs( (DateTimeToSeconds (sONt) - DateTimeToSeconds (sOFFt)) )
else
formula = HrsMinsSecs( DateTimeToSeconds (sOFFt) - DateTimeToSeconds(mtime))
end if
end if
Thaanks for any help!
WhilePrintingRecords
global mtime As DateTime
Dim sONt As DateTime
Dim sOFFt As DateTime
sOFFt = DateTimeValue ({@SignOff})
if NextIsNull ({Reason Code Events.Time Stamp}) then
formula = HrsMinsSecs( DateTimeToSeconds (sOFFt) - DateTimeToSeconds(mtime))
else
sONt = DateTimeValue ({@SignOn})
if {Reason Code Desc.Reason Code Description} <> "SIGN OFF - END OF SHIFT" then
formula = HrsMinsSecs( (DateTimeToSeconds (sONt) - DateTimeToSeconds (sOFFt)) )
else
formula = HrsMinsSecs( DateTimeToSeconds (sOFFt) - DateTimeToSeconds(mtime))
end if
end if
Thaanks for any help!