Cross project unique ids

M

Mark

Does anyone know how the unique ids are created in the master project for the
sub project tasks?
 
J

Jack Dahlgren

Sort of. It takes an integer multiple (1,2,3,4 ...) of a very big number and
adds it to the Unique ID's of the sub-project tasks.You can find what the
very big number is by looking at the Unique ID of a task with only the
sub-project open and then looking at it when it is inserted as part of a
sub-project. The very big number starts with 4 (can't recite it off the top
of my head) so if the UID is 8...........something or 12...........something
then simply subtract the original UID from it and divide by 2 (for 8......)
or 3 (for 12......).

You can use a custom field and formula to find out the "original" UID using
the MOD function.
A formula like:
[UniqueID]MOD<verybignumber> will give you the remainder which happens to be
the original UID.

More on the MOD function here:
http://zo-d.com/blog/archives/programming/vba-integer-division-and-mod.html

-Jack Dahlgren
 
M

Mark

Thanks for your reply. Its the large number i am trying to find out, but i
can not find any pattern to this when adding lots of sub projects.

Any ideas?

Jack Dahlgren said:
Sort of. It takes an integer multiple (1,2,3,4 ...) of a very big number and
adds it to the Unique ID's of the sub-project tasks.You can find what the
very big number is by looking at the Unique ID of a task with only the
sub-project open and then looking at it when it is inserted as part of a
sub-project. The very big number starts with 4 (can't recite it off the top
of my head) so if the UID is 8...........something or 12...........something
then simply subtract the original UID from it and divide by 2 (for 8......)
or 3 (for 12......).

You can use a custom field and formula to find out the "original" UID using
the MOD function.
A formula like:
[UniqueID]MOD<verybignumber> will give you the remainder which happens to be
the original UID.

More on the MOD function here:
http://zo-d.com/blog/archives/programming/vba-integer-division-and-mod.html

-Jack Dahlgren



Mark said:
Does anyone know how the unique ids are created in the master project for
the
sub project tasks?
 
M

Mark

I now get it Jack. Just looking for a method now to identify which multiple
is used for which project.

Mark said:
Thanks for your reply. Its the large number i am trying to find out, but i
can not find any pattern to this when adding lots of sub projects.

Any ideas?

Jack Dahlgren said:
Sort of. It takes an integer multiple (1,2,3,4 ...) of a very big number and
adds it to the Unique ID's of the sub-project tasks.You can find what the
very big number is by looking at the Unique ID of a task with only the
sub-project open and then looking at it when it is inserted as part of a
sub-project. The very big number starts with 4 (can't recite it off the top
of my head) so if the UID is 8...........something or 12...........something
then simply subtract the original UID from it and divide by 2 (for 8......)
or 3 (for 12......).

You can use a custom field and formula to find out the "original" UID using
the MOD function.
A formula like:
[UniqueID]MOD<verybignumber> will give you the remainder which happens to be
the original UID.

More on the MOD function here:
http://zo-d.com/blog/archives/programming/vba-integer-division-and-mod.html

-Jack Dahlgren



Mark said:
Does anyone know how the unique ids are created in the master project for
the
sub project tasks?
 
J

Jack Dahlgren

I think the pattern is 2^22 x (1+inserted project number) + Task unique ID.

-Jack Dahlgren


Mark said:
I now get it Jack. Just looking for a method now to identify which
multiple
is used for which project.

Mark said:
Thanks for your reply. Its the large number i am trying to find out, but
i
can not find any pattern to this when adding lots of sub projects.

Any ideas?

Jack Dahlgren said:
Sort of. It takes an integer multiple (1,2,3,4 ...) of a very big
number and
adds it to the Unique ID's of the sub-project tasks.You can find what
the
very big number is by looking at the Unique ID of a task with only the
sub-project open and then looking at it when it is inserted as part of
a
sub-project. The very big number starts with 4 (can't recite it off the
top
of my head) so if the UID is 8...........something or
12...........something
then simply subtract the original UID from it and divide by 2 (for
8......)
or 3 (for 12......).

You can use a custom field and formula to find out the "original" UID
using
the MOD function.
A formula like:
[UniqueID]MOD<verybignumber> will give you the remainder which happens
to be
the original UID.

More on the MOD function here:
http://zo-d.com/blog/archives/programming/vba-integer-division-and-mod.html

-Jack Dahlgren



Does anyone know how the unique ids are created in the master project
for
the
sub project tasks?
 
J

Jim Aksel

Jack - write this up and have Mike post it as an FAQ.
The magic number becomes 4194304 (2^22)

Try this ... Create 4 new projects. Then, Window/New... select projects 2
and 4. Select OK. A new Project5 opens with Project2 and Project4 as the
inserted projects. insert the UniqueID field. The integers associated with
these would be 2 and 4 (or perhaps 1 and 3). At any rate you would expect
the associated ProjectID integer to be separated by two.

MasterProject UID = 2^22(1+ProjectID Integer)+Original UniqueID
2^22(1+2)+1 =

What you might expect is Project2 UID to start 2^22(1+2)+1=1258913
And for Project4 you might expect:
2^22(1+4)+1=10971521

Instead what we get is:
MasterProject2 UniqueID for task1 = 2^22(1+1)+1 =
8388609
masterProject4 UniqueID for task1 = 2^22(1+2)=12582913

If I do it again and select projects 3 and 5 I get the same numbers as I did
above.

So it appears the calculation is:
2^22(1+the position of insertion into the new master file)+Old UniqueID
So now all we need is a method to divine the inserted position, which can
also be done. If you are looping through, hears some portion of code that
will get you that position:

Dim sProject As Subproject
Dim ppostion As Integer
pposition = 0
For Each sProject In Application.ActiveProject.Subprojects
pposition = pposition + 1
MsgBox (pposition)

Next sProject


It's too late at night for me to ponder what happens if one of the inserted
projects has a master/subproject scenario. We leave that as an excercise for
the reader (hee hee)

There may be a way to avoid all this... What I have done in the past is
create a field with a formula such as Text1=[UniqueID]. For some reason,
this column retains the old UniqueID even though the uniqueID field changes
when you create the MasterProject.


If this post was helpful, please consider rating it.

Jim

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project



Jack Dahlgren said:
I think the pattern is 2^22 x (1+inserted project number) + Task unique ID.

-Jack Dahlgren


Mark said:
I now get it Jack. Just looking for a method now to identify which
multiple
is used for which project.

Mark said:
Thanks for your reply. Its the large number i am trying to find out, but
i
can not find any pattern to this when adding lots of sub projects.

Any ideas?

:

Sort of. It takes an integer multiple (1,2,3,4 ...) of a very big
number and
adds it to the Unique ID's of the sub-project tasks.You can find what
the
very big number is by looking at the Unique ID of a task with only the
sub-project open and then looking at it when it is inserted as part of
a
sub-project. The very big number starts with 4 (can't recite it off the
top
of my head) so if the UID is 8...........something or
12...........something
then simply subtract the original UID from it and divide by 2 (for
8......)
or 3 (for 12......).

You can use a custom field and formula to find out the "original" UID
using
the MOD function.
A formula like:
[UniqueID]MOD<verybignumber> will give you the remainder which happens
to be
the original UID.

More on the MOD function here:
http://zo-d.com/blog/archives/programming/vba-integer-division-and-mod.html

-Jack Dahlgren



Does anyone know how the unique ids are created in the master project
for
the
sub project tasks?
 
J

Jack Dahlgren

Jim,

The Project Summary task for the inserted project has a unique Id of where
it is inserted. The first inserted project is 1.

-Jack


Jim Aksel said:
Jack - write this up and have Mike post it as an FAQ.
The magic number becomes 4194304 (2^22)

Try this ... Create 4 new projects. Then, Window/New... select projects
2
and 4. Select OK. A new Project5 opens with Project2 and Project4 as the
inserted projects. insert the UniqueID field. The integers associated
with
these would be 2 and 4 (or perhaps 1 and 3). At any rate you would expect
the associated ProjectID integer to be separated by two.

MasterProject UID = 2^22(1+ProjectID Integer)+Original UniqueID
2^22(1+2)+1 =

What you might expect is Project2 UID to start 2^22(1+2)+1=1258913
And for Project4 you might expect:
2^22(1+4)+1=10971521

Instead what we get is:
MasterProject2 UniqueID for task1 = 2^22(1+1)+1 =
8388609
masterProject4 UniqueID for task1 = 2^22(1+2)=12582913

If I do it again and select projects 3 and 5 I get the same numbers as I
did
above.

So it appears the calculation is:
2^22(1+the position of insertion into the new master file)+Old UniqueID
So now all we need is a method to divine the inserted position, which can
also be done. If you are looping through, hears some portion of code that
will get you that position:

Dim sProject As Subproject
Dim ppostion As Integer
pposition = 0
For Each sProject In Application.ActiveProject.Subprojects
pposition = pposition + 1
MsgBox (pposition)

Next sProject


It's too late at night for me to ponder what happens if one of the
inserted
projects has a master/subproject scenario. We leave that as an excercise
for
the reader (hee hee)

There may be a way to avoid all this... What I have done in the past is
create a field with a formula such as Text1=[UniqueID]. For some reason,
this column retains the old UniqueID even though the uniqueID field
changes
when you create the MasterProject.


If this post was helpful, please consider rating it.

Jim

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project



Jack Dahlgren said:
I think the pattern is 2^22 x (1+inserted project number) + Task unique
ID.

-Jack Dahlgren


Mark said:
I now get it Jack. Just looking for a method now to identify which
multiple
is used for which project.

:

Thanks for your reply. Its the large number i am trying to find out,
but
i
can not find any pattern to this when adding lots of sub projects.

Any ideas?

:

Sort of. It takes an integer multiple (1,2,3,4 ...) of a very big
number and
adds it to the Unique ID's of the sub-project tasks.You can find
what
the
very big number is by looking at the Unique ID of a task with only
the
sub-project open and then looking at it when it is inserted as part
of
a
sub-project. The very big number starts with 4 (can't recite it off
the
top
of my head) so if the UID is 8...........something or
12...........something
then simply subtract the original UID from it and divide by 2 (for
8......)
or 3 (for 12......).

You can use a custom field and formula to find out the "original"
UID
using
the MOD function.
A formula like:
[UniqueID]MOD<verybignumber> will give you the remainder which
happens
to be
the original UID.

More on the MOD function here:
http://zo-d.com/blog/archives/programming/vba-integer-division-and-mod.html

-Jack Dahlgren



Does anyone know how the unique ids are created in the master
project
for
the
sub project tasks?
 

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