Master project Dependency

P

prem1234

Hi All,

I am working on a MS Project addin.

We use "PredecessorTasks" collection on Task object to get the
details of the predecessor tasks of a task. This works fine when the
project is a simple project. In case of a project which has a
subproject inserted in it, if a task in master project has a
predecessor task in inserted project, the collection does not show
that predecessor. However the "TaskDependencies" collection on the
task shows the dependency. But the issue is if we inspect the
attributes of corresponding "TaskDependencies.Item(i).From", none of
them(ID, UniqueID)except "Name" match with that of predecessor task.
Is there any attribute (other than "name") on a task's
"TaskDependencies.Item(i).From" that can be used to get the
corresponding predecessor Task object in Tasks collection of
subproject (ie. An attribute that will be always same on
TaskDependencies.Item(i).From and corresponding Tasks.Item(j) so that
I can relate these two)?

Thanks in advance,
 
M

Mike Glen

Hi prem1234,

Try posting on the developer newsgroup. Please see FAQ Item: 24. Project
Newsgroups. FAQs, companion products and other useful Project information
can be seen at this web address: http://project.mvps.org/faqs.htm

Mike Glen
Project MVP
 
J

John

prem1234 said:
Hi All,

I am working on a MS Project addin.

We use "PredecessorTasks" collection on Task object to get the
details of the predecessor tasks of a task. This works fine when the
project is a simple project. In case of a project which has a
subproject inserted in it, if a task in master project has a
predecessor task in inserted project, the collection does not show
that predecessor. However the "TaskDependencies" collection on the
task shows the dependency. But the issue is if we inspect the
attributes of corresponding "TaskDependencies.Item(i).From", none of
them(ID, UniqueID)except "Name" match with that of predecessor task.
Is there any attribute (other than "name") on a task's
"TaskDependencies.Item(i).From" that can be used to get the
corresponding predecessor Task object in Tasks collection of
subproject (ie. An attribute that will be always same on
TaskDependencies.Item(i).From and corresponding Tasks.Item(j) so that
I can relate these two)?

Thanks in advance,

prem1234,
Even though Mike rightly directed you to our sister newsgroup, I didn't
see your post there, (at least when I checked the newgroups), so I'll
answer it here.

Unfortunately the TaskDependencies collection does not have a direct
means of referencing external dependencies. However there is a way to
work around it.

Several years ago, before the TaskDependencies collection was added to
the Project object model, I wrote a macro which converts a dynamically
consolidated master file with external links between subprojects into a
static master file with the external links converted to normal
predecessors/successors. In that macro, I parse out the Predecessor and
Successor fields to identify external link information including the ID
in the subproject files. This method isn't very elegant, but it is very
effective.

John
Project MVP
 
P

prem1234

prem1234,
Even though Mike rightly directed you to our sister newsgroup, I didn't
see your post there, (at least when I checked the newgroups), so I'll
answer it here.

Unfortunately the TaskDependencies collection does not have a direct
means of referencing external dependencies. However there is a way to
work around it.

Several years ago, before the TaskDependencies collection was added to
the Project object model, I wrote a macro which converts a dynamically
consolidated master file with external links between subprojects into a
static master file with the external links converted to normal
predecessors/successors. In that macro, I parse out the Predecessor and
Successor fields to identify external link information including the ID
in the subproject files. This method isn't very elegant, but it is very
effective.

John
Project MVP- Hide quoted text -

- Show quoted text -

Hi John, thanks for reply.
I want to get clarified one thing. Is the comma separated Predecessors
attribute contains the values in the same order as the dependencies
appear in TaskDependencies collection? that is, item n in
Predecessors corresponds to the n'th predecesoor dependency in
TaskDependencies collection?

Thanks,
 
J

John

prem1234 said:
Hi John, thanks for reply.
I want to get clarified one thing. Is the comma separated Predecessors
attribute contains the values in the same order as the dependencies
appear in TaskDependencies collection? that is, item n in
Predecessors corresponds to the n'th predecesoor dependency in
TaskDependencies collection?

Thanks,

prem1234,
As far as I know, yes - I've never tried it. Since what you see in a
displayed view is simply a formatted presentation of what is in
Project's underlying database, I have to believe that the data is stored
in a given order. Regardless of what method you use to decode that data,
it will be taken from the order in which it is stored. Boy, how's that
for some techie talk :)

John
Project MVP
 

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