E
Emile
Using timescalevalues, funny things can happen
In code below you see a difference in time in date1 and date2 of 20 minutes.
Calculating pjResourceTimescaledRemainingAvailability gives strange results;
higher members of resulting collection gives an "unexpected error", making it
impossible to read out lower indexes of the array. If the difference is for
example 2 minutes, there is no problem. What is causing this en how to solve
this ? Of course there is always a workaround, but there must be an
explanation for this behaviour of timescaledata. The resource has no tasks to
do. The same occurs using pjResourceTimescaledWorkAvailability. If date1 and
date2 are identical, also funny things happen. .count seems to have a limit
(try 55 when the resolution is minutes).
Dim TSV As TimeScaleValues
Dim date1 As Date
Dim date2 As Date
Dim L As Long
date1 = DateSerial(2007, 8, 13) + TimeSerial(10, 0, 0)
date2 = DateSerial(2007, 8, 13) + TimeSerial(10, 20, 0)
Set TSV = ActiveProject.Resources(1).TimeScaleData( _
StartDate:=CStr(date1), _
EndDate:=CStr(date2), _
Type:=pjResourceTimescaledRemainingAvailability_
TimeScaleUnit:=pjTimescaleMinutes, _
Count:=1)
'calculate total
For n = 1 To TSV.Count
L = L + Val(tsvN(n).Value)
Next n
In code below you see a difference in time in date1 and date2 of 20 minutes.
Calculating pjResourceTimescaledRemainingAvailability gives strange results;
higher members of resulting collection gives an "unexpected error", making it
impossible to read out lower indexes of the array. If the difference is for
example 2 minutes, there is no problem. What is causing this en how to solve
this ? Of course there is always a workaround, but there must be an
explanation for this behaviour of timescaledata. The resource has no tasks to
do. The same occurs using pjResourceTimescaledWorkAvailability. If date1 and
date2 are identical, also funny things happen. .count seems to have a limit
(try 55 when the resolution is minutes).
Dim TSV As TimeScaleValues
Dim date1 As Date
Dim date2 As Date
Dim L As Long
date1 = DateSerial(2007, 8, 13) + TimeSerial(10, 0, 0)
date2 = DateSerial(2007, 8, 13) + TimeSerial(10, 20, 0)
Set TSV = ActiveProject.Resources(1).TimeScaleData( _
StartDate:=CStr(date1), _
EndDate:=CStr(date2), _
Type:=pjResourceTimescaledRemainingAvailability_
TimeScaleUnit:=pjTimescaleMinutes, _
Count:=1)
'calculate total
For n = 1 To TSV.Count
L = L + Val(tsvN(n).Value)
Next n