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!

Problems with date functions

Status
Not open for further replies.

piercey

Programmer
Apr 10, 2003
19
GB
Hi List,

I have a report which calculates the difference in minutes between two dates taking into account daily start and end times that are stored on one of our tables.

I have the following code as part of a formula on one of my subreports. It works with no problem, but as soon as I include a 'DateAdd' as the argument in a 'DayOfWeek' function the subreport returns a blank (even if other code in the formula returns a value!). The subreport must be failing in some way, does anyone have any idea what I may be doing wrong?

This is the code:-

If DateAdd ('d',dayCounter,{Incident.Logged Date}) <> {NonWorkingDay.dtDate} Then
(
Select DayOfWeek(DateAdd('d',dayCounter,{Incident.Logged Date}))
Case 2 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Resolve Monday Start},{Incident.Resolve Monday Stop})
Case 3 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Tuesday Start},{Incident.Resolve Tuesday Stop})
Case 4 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Wednesday Start},{Incident.Wednesday Stop})
Case 5 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Thursday Start},{Incident.Thursday Stop})
Case 6 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Friday Start},{Incident.Friday Stop})
Case 7 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Saturday Start},{Incident.Saturday Stop})
Case 1 :
minutesDifference := minutesDifference + DateDiff ('n',{Incident.Sunday Start},{Incident.Sunday Stop})
default : minutesDifference := minutesDifference + 0;
);

I'm using Crystal 9.0.

Thanks.
 
What is the entire formula? You left out the variables at the beginning for dayCounter and minutesDifference, and I'm specifically wondering about the dayCounter.

Also, what formula are you using for display of this formulas results?

If the dayCounter formula originates in the main report, are you remembering to identify it as a shared variable?

-LB
 
Thanks for the reply.

I didn't print the entire formula because it's so big! I've printed the whole thing below, note that I changed some of the variable names in the first post to conserve space. What you see below is the unadulterated version.

Basically if the following line holds a DateAdd function or a variable holding the result of a DateAdd function, the function returns nothing (even if I replace 'minutesDifference' at the bottom of the page with a numeric value).

Select DayOfWeek(DateAdd('d',dayCounter,{CSF_SpentSLATime.Logged Date}))

Code listing for function -

local numbervar minutesDifference;
local numbervar dayCounter;

global numbervar minutesStart;
global numbervar minutesMiddle;
global numbervar minutesEnd;

If Date({CSF_SpentSLATime.Logged Date}) = Date({CSF_SpentSLATime.Resolved Date}) Then
(
// Incident Logged and Resolved To on same day
If {CSF_SpentSLATime.Resolved Date} <> {Sam7_SeNonWorkingDay.dtDate} Then
(
Select DayOfWeek({CSF_SpentSLATime.Resolved Date})
Case 2 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Monday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Monday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Monday Stop}),Minute({CSF_SpentSLATime.Resolve Monday Stop}),Second({CSF_SpentSLATime.Resolve Monday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
Case 3 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Tuesday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Tuesday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Tuesday Stop}),Minute({CSF_SpentSLATime.Resolve Tuesday Stop}),Second({CSF_SpentSLATime.Resolve Tuesday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
Case 4 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Wednesday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Wednesday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Wednesday Stop}),Minute({CSF_SpentSLATime.Resolve Wednesday Stop}),Second({CSF_SpentSLATime.Resolve Wednesday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
Case 5 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Thursday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Thursday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Thursday Stop}),Minute({CSF_SpentSLATime.Resolve Thursday Stop}),Second({CSF_SpentSLATime.Resolve Thursday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
Case 6 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Friday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Friday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Friday Stop}),Minute({CSF_SpentSLATime.Resolve Friday Stop}),Second({CSF_SpentSLATime.Resolve Friday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
Case 7 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Saturday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Saturday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Saturday Stop}),Minute({CSF_SpentSLATime.Resolve Saturday Stop}),Second({CSF_SpentSLATime.Resolve Saturday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
Case 1 :
If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Sunday Start}) Then
(
minutesDifference := 0
)
Else If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Sunday Stop}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Sunday Stop}),Minute({CSF_SpentSLATime.Resolve Sunday Stop}),Second({CSF_SpentSLATime.Resolve Sunday Stop})))
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},{CSF_SpentSLATime.Resolved Date})
)
default : 0;
);
)
Else
(
// Incident Logged and Resolved To on different days
//
// Calculate First Day
If {CSF_SpentSLATime.Resolved Date} <> {Sam7_SeNonWorkingDay.dtDate} Then
(
Select DayOfWeek({CSF_SpentSLATime.Resolved Date})
Case 2 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Monday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Monday Start},{CSF_SpentSLATime.Resolve Monday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Monday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Monday Stop}),Minute({CSF_SpentSLATime.Resolve Monday Stop}),Second({CSF_SpentSLATime.Resolve Monday Stop})))
)
Case 3 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Tuesday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Tuesday Start},{CSF_SpentSLATime.Resolve Tuesday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Tuesday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Tuesday Stop}),Minute({CSF_SpentSLATime.Resolve Tuesday Stop}),Second({CSF_SpentSLATime.Resolve Tuesday Stop})))
)
Case 4 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Wednesday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Wednesday Start},{CSF_SpentSLATime.Resolve Wednesday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Wednesday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Wednesday Stop}),Minute({CSF_SpentSLATime.Resolve Wednesday Stop}),Second({CSF_SpentSLATime.Resolve Wednesday Stop})))
)
Case 5 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Thursday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Thursday Start},{CSF_SpentSLATime.Resolve Thursday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Thursday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Thursday Stop}),Minute({CSF_SpentSLATime.Resolve Thursday Stop}),Second({CSF_SpentSLATime.Resolve Thursday Stop})))
)
Case 6 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Friday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Friday Start},{CSF_SpentSLATime.Resolve Friday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Friday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Friday Stop}),Minute({CSF_SpentSLATime.Resolve Friday Stop}),Second({CSF_SpentSLATime.Resolve Friday Stop})))
)
Case 7 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Saturday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Saturday Start},{CSF_SpentSLATime.Resolve Saturday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Saturday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Saturday Stop}),Minute({CSF_SpentSLATime.Resolve Saturday Stop}),Second({CSF_SpentSLATime.Resolve Saturday Stop})))
)
Case 1 :
If Time({CSF_SpentSLATime.Logged Date}) < Time({CSF_SpentSLATime.Resolve Sunday Start}) Then
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Resolve Sunday Start},{CSF_SpentSLATime.Resolve Sunday Stop})
)
Else If Time({CSF_SpentSLATime.Logged Date}) > Time({CSF_SpentSLATime.Resolve Sunday Stop}) Then
(
minutesDifference := 0
)
Else
(
minutesDifference := DateDiff('n',{CSF_SpentSLATime.Logged Date},DateTimeValue(Year({CSF_SpentSLATime.Logged Date}),Month({CSF_SpentSLATime.Logged Date}),Day({CSF_SpentSLATime.Logged Date}),Hour({CSF_SpentSLATime.Resolve Sunday Stop}),Minute({CSF_SpentSLATime.Resolve Monday Stop}),Second({CSF_SpentSLATime.Resolve Sunday Stop})))
)
default : 0;
minutesStart := minutesDifference;
);
// Calculate Middle Days (If any)
If Date(DateAdd ('d',1,{CSF_SpentSLATime.Logged Date})) <> Date({CSF_SpentSLATime.Resolved Date}) Then
(
// Dates are more than one day apart
dayCounter := 2;
While DateAdd ('d',dayCounter,{CSF_SpentSLATime.Logged Date}) < {CSF_SpentSLATime.Resolved Date}
Do
(
If DateAdd ('d',dayCounter,{CSF_SpentSLATime.Logged Date}) <> {Sam7_SeNonWorkingDay.dtDate} Then
(
Select DayOfWeek(DateAdd('d',dayCounter,{CSF_SpentSLATime.Logged Date}))
Case 2 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Monday Start},{CSF_SpentSLATime.Resolve Monday Stop})
Case 3 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Tuesday Start},{CSF_SpentSLATime.Resolve Tuesday Stop})
Case 4 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Wednesday Start},{CSF_SpentSLATime.Resolve Wednesday Stop})
Case 5 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Thursday Start},{CSF_SpentSLATime.Resolve Thursday Stop})
Case 6 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Friday Start},{CSF_SpentSLATime.Resolve Friday Stop})
Case 7 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Saturday Start},{CSF_SpentSLATime.Resolve Saturday Stop})
Case 1 :
minutesDifference := minutesDifference + DateDiff ('n',{CSF_SpentSLATime.Resolve Sunday Start},{CSF_SpentSLATime.Resolve Sunday Stop})
default : minutesDifference := minutesDifference + 0;
);
minutesMiddle := minutesDifference - minutesStart;
dayCounter := dayCounter + 1;
)
);
// Calculate Last Day
If {CSF_SpentSLATime.Resolved Date} <> {Sam7_SeNonWorkingDay.dtDate} Then
(
Select DayOfWeek({CSF_SpentSLATime.Resolved Date})
Case 2 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Monday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Monday Start},{CSF_SpentSLATime.Resolve Monday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Monday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Monday Start}),Minute({CSF_SpentSLATime.Resolve Monday Start}),Second({CSF_SpentSLATime.Resolve Monday Start})),{CSF_SpentSLATime.Resolved Date})
)
Case 3 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Tuesday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Tuesday Start},{CSF_SpentSLATime.Resolve Tuesday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Tuesday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Tuesday Start}),Minute({CSF_SpentSLATime.Resolve Tuesday Start}),Second({CSF_SpentSLATime.Resolve Tuesday Start})),{CSF_SpentSLATime.Resolved Date})
)
Case 4 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Wednesday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Wednesday Start},{CSF_SpentSLATime.Resolve Wednesday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Wednesday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Wednesday Start}),Minute({CSF_SpentSLATime.Resolve Wednesday Start}),Second({CSF_SpentSLATime.Resolve Wednesday Start})),{CSF_SpentSLATime.Resolved Date})
)
Case 5 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Thursday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Thursday Start},{CSF_SpentSLATime.Resolve Thursday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Thursday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Thursday Start}),Minute({CSF_SpentSLATime.Resolve Thursday Start}),Second({CSF_SpentSLATime.Resolve Thursday Start})),{CSF_SpentSLATime.Resolved Date})
)
Case 6 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Friday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Friday Start},{CSF_SpentSLATime.Resolve Friday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Friday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Friday Start}),Minute({CSF_SpentSLATime.Resolve Friday Start}),Second({CSF_SpentSLATime.Resolve Friday Start})),{CSF_SpentSLATime.Resolved Date})
)
Case 7 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Saturday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Saturday Start},{CSF_SpentSLATime.Resolve Saturday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Saturday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Saturday Start}),Minute({CSF_SpentSLATime.Resolve Saturday Start}),Second({CSF_SpentSLATime.Resolve Saturday Start})),{CSF_SpentSLATime.Resolved Date})
)
Case 1 :
If Time({CSF_SpentSLATime.Resolved Date}) > Time({CSF_SpentSLATime.Resolve Sunday Stop}) Then
(
minutesDifference := minutesDifference + DateDiff('n',{CSF_SpentSLATime.Resolve Sunday Start},{CSF_SpentSLATime.Resolve Sunday Stop})
)
Else If Time({CSF_SpentSLATime.Resolved Date}) < Time({CSF_SpentSLATime.Resolve Sunday Start}) Then
(
minutesDifference := minutesDifference + 0
)
Else
(
minutesDifference := minutesDifference + DateDiff('n',DateTimeValue(Year({CSF_SpentSLATime.Resolved Date}),Month({CSF_SpentSLATime.Resolved Date}),Day({CSF_SpentSLATime.Resolved Date}),Hour({CSF_SpentSLATime.Resolve Sunday Start}),Minute({CSF_SpentSLATime.Resolve Sunday Start}),Second({CSF_SpentSLATime.Resolve Sunday Start})),{CSF_SpentSLATime.Resolved Date})
)
default : 0;
);
minutesEnd := minutesDifference - minutesMiddle;
minutesDifference
);

minutesDifference
 
Just quickly--you initialize dayCounter := 2, and then reference it twice, and then set it equal to dayCounter + 1--but never reference it again. Not sure this is the issue, but I can't spend more time on this till later.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top