A
Andy Lenik
Hi All
As part of a larger script I'm trying to flag up anything that's not
going to be finished on time. I later filter on these flags and save
the view as an image. That's easy enough, but in order for the report
to make any sense then I need also to show which parents they belong
to.
So, what I'm trying to do is for any task that fits the criteria is to
also set the flag for its parent(s)... this works fine if I open up an
MPP on its own, but when I open my 'main' MPP (with several reports
linked in) only some of them get the parent. Taking one example, when
opened on its own, the first 'warning' task is OutlineLevel 3, and its
parent is OutlineLevel 2 (obviously).
However, when opening within my main report then the OutlineLevel of
the same task's OutlineParent is 0 (zero).
Any ideas? I appreciate I need to come up with a way of replicating
this, but don't know where to start as some of my linked reports work
fine???
Anyway, here's part of my code. And thanks in advance, Andy:
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
'** If there are any delayed tasks then at the end of this
we'll offer _
to create spreadsheet for those. 'Remember' the tasks
behind schedule _
by setting Flag10 to true
If t.Flag10 = False Then 'This could be a parent that has
already been _
set to True, so you want to keep
it that way!
If t.PercentComplete < 100 Then
dSchedComlete = Now + (t.RemainingDuration /
lMinsInDay)
If dSchedComlete > t.Finish Then
t.Flag10 = True
bDelayedTasks = True
'** Flag its parent(s) so they show in the
report
Dim iOLineLevel As Integer, tParentTask As
Task
iOLineLevel = t.OutlineLevel
Do Until iOLineLevel <= 0 '????
If tParentTask Is Nothing Then
Set tParentTask = t.OutlineParent
Else
Set tParentTask =
tParentTask.OutlineParent
End If
If tParentTask.Flag10 Then Exit Do
'already have the rest of that hierarchy
tParentTask.Flag10 = True
iOLineLevel = tParentTask.OutlineLevel
Loop
Set tParentTask = Nothing
Else
t.Flag10 = False
End If
End If
End If ' t.Flag10 = flase
end if
next t
As part of a larger script I'm trying to flag up anything that's not
going to be finished on time. I later filter on these flags and save
the view as an image. That's easy enough, but in order for the report
to make any sense then I need also to show which parents they belong
to.
So, what I'm trying to do is for any task that fits the criteria is to
also set the flag for its parent(s)... this works fine if I open up an
MPP on its own, but when I open my 'main' MPP (with several reports
linked in) only some of them get the parent. Taking one example, when
opened on its own, the first 'warning' task is OutlineLevel 3, and its
parent is OutlineLevel 2 (obviously).
However, when opening within my main report then the OutlineLevel of
the same task's OutlineParent is 0 (zero).
Any ideas? I appreciate I need to come up with a way of replicating
this, but don't know where to start as some of my linked reports work
fine???
Anyway, here's part of my code. And thanks in advance, Andy:
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
'** If there are any delayed tasks then at the end of this
we'll offer _
to create spreadsheet for those. 'Remember' the tasks
behind schedule _
by setting Flag10 to true
If t.Flag10 = False Then 'This could be a parent that has
already been _
set to True, so you want to keep
it that way!
If t.PercentComplete < 100 Then
dSchedComlete = Now + (t.RemainingDuration /
lMinsInDay)
If dSchedComlete > t.Finish Then
t.Flag10 = True
bDelayedTasks = True
'** Flag its parent(s) so they show in the
report
Dim iOLineLevel As Integer, tParentTask As
Task
iOLineLevel = t.OutlineLevel
Do Until iOLineLevel <= 0 '????
If tParentTask Is Nothing Then
Set tParentTask = t.OutlineParent
Else
Set tParentTask =
tParentTask.OutlineParent
End If
If tParentTask.Flag10 Then Exit Do
'already have the rest of that hierarchy
tParentTask.Flag10 = True
iOLineLevel = tParentTask.OutlineLevel
Loop
Set tParentTask = Nothing
Else
t.Flag10 = False
End If
End If
End If ' t.Flag10 = flase
end if
next t