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.
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.