OutlineParent on tasks within a linked report

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
 
J

John

Andy,
I'm not sure what you mean by "linked reports" but it sounds like you
have a consolidated master (i.e. master file with inserted subprojects).
If that is the case you might want to make sure the master file is fully
"exploded" before you set Flag10. One simple line of code will do that:
OutlineShowTasks expandinsertedprojects:=True

Why not take the simple approach. Use your code for setting Flag10 on
individual tasks and then apply the filter. When you apply the filter be
sure to check the "show related summary rows" box at the bottom of the
filter definition window (or select that option if the filter is set by
the VBA code).

Hope this helps.
John
 
A

Andy Lenik

Oh I do like an answer like this... John, you've hit the nail on the
head with my requirement, thank you! The simple line of code is a good
one, and as you've pointed out the simplest solution is always the
best... I just need to add:
ShowSummaryTasks:=True
....to my filter as I create it (VBA - FilterEdit command). A lot
better than trying to loop through and find the parents!

Many thanks!
Andy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top