Enterprise Task Field - Assignment Level Data

G

gobogo90

I need assistance retrieving data from an Enterprise Task Text field
called Time Reporting Comments. I have displayed the field in the
Task Usage view. Though the field is a Task Text field, Project
allows the user to set values at the assignment level. It is that
data I am trying to retrieve and change.

I recorded a macro where I change the value of the field for an
assignment, and the macro uses the following line to store new data:

SetResourceField Field:="Time Reporting Comments", Value:="Reconfig-
Joe"

In my macro I loop over all tasks and assignments, but I do not really
know where this data may be stored and thus don't know the syntax to
retrieve it. I can grab the data at the Task level,but not the
assignment level. The following line is my best effort yet but fails
with a type mismatch:

Task_Comment =
ActiveProject.Tasks(Task_Cur).Assignments(Ass_Cur).GetField(FieldID:=FieldNameToFieldConstant(FieldName:="Time
Reporting Comments"))

Any suggestions?

G
 
J

John

gobogo90 said:
I need assistance retrieving data from an Enterprise Task Text field
called Time Reporting Comments. I have displayed the field in the
Task Usage view. Though the field is a Task Text field, Project
allows the user to set values at the assignment level. It is that
data I am trying to retrieve and change.

I recorded a macro where I change the value of the field for an
assignment, and the macro uses the following line to store new data:

SetResourceField Field:="Time Reporting Comments", Value:="Reconfig-
Joe"

In my macro I loop over all tasks and assignments, but I do not really
know where this data may be stored and thus don't know the syntax to
retrieve it. I can grab the data at the Task level,but not the
assignment level. The following line is my best effort yet but fails
with a type mismatch:

Task_Comment =
ActiveProject.Tasks(Task_Cur).Assignments(Ass_Cur).GetField(FieldID:=FieldName
ToFieldConstant(FieldName:="Time
Reporting Comments"))

Any suggestions?

G

gobogo90,
First, you should be aware that spare fields will not show up in the
timscaled data of either usage view (you mentioned that you added it to
the Task Usage view). It can be displayed as static data in the tabular
data on the left, but not as timescaled data on the right. Maybe you
were just trying to see the assignment rows.

Second, the "SetResourceFIeld" Method does not set the value at the
assignment level, it sets it at the resource level, just as the method
implies. To set a value at the assignment level, you need something like,
ActiveProject.Resources(whoever).Assignments(whichever).EnterpriseTaskTex
t1 = [your value]

As far as retrieving that value, your code failed for two reasons.
First, the FieldNameToFIeldConstant Method applies only to task and
resource fields, not to assignment fields (that might have changed in
Project 2007 - I didn't check). Second, for that method you must use the
actual field name (i.e. EnterpriseTaskTextn), not the custom name (i.e.
Time Reporting Comments). However, one simple way to retrieve the value
is with the following syntax (basically the same syntax as above)
Task_Comment =
ActiveProject.Resources(whoever).Assignments(whichever).Enterprisetasktex
t1

Hope this helps.
John
Project MVP
 
G

gobogo90

John-

Thanks very much for the reply. I understand what you are saying in
theory, but in practice, not so much.

I am first trying to determine which EnterpriseTaskText[n] has been
used for "Time Reporting Comments".
The value of pjField for "Time Reporting Comments" is 188776487 using
FieldNameToFieldConstant. None of the pjField constants match that
value so I don't know which EnterpriseTaskText[n] to use.

Further, just to try it, the following line does not execute, throwing
a 483 error- Object does not support property.

ActiveProject.Resources(i).Assignments(j).EnterpriseTaskText12 =
"Testing"

Could it work differently in 2007?

Greg
 
J

John

gobogo90 said:
John-

Thanks very much for the reply. I understand what you are saying in
theory, but in practice, not so much.

I am first trying to determine which EnterpriseTaskText[n] has been
used for "Time Reporting Comments".
The value of pjField for "Time Reporting Comments" is 188776487 using
FieldNameToFieldConstant. None of the pjField constants match that
value so I don't know which EnterpriseTaskText[n] to use.

Further, just to try it, the following line does not execute, throwing
a 483 error- Object does not support property.

ActiveProject.Resources(i).Assignments(j).EnterpriseTaskText12 =
"Testing"

Could it work differently in 2007?

Greg

Greg,
You're welcome.

Oops, my bad. I messed up in the syntax I gave you. It should have been,
ActiveProject.Resources(whoever).Assignments(whichever).EnterpriseTextn

The object is an assignment so "EnterpriseTaskTextn" doesn't exist for
that object.

See if that helps.
John
Project MVP
 
J

John

www.projectserver.cz said:

person,
I tried your suggested msdn2 link and I found nothing that relates to
the posted question. Furthermore, I just tried both of the statements
shown below on Project 2007 Pro, and they work fine. I can load the
field using VBA and I can read the field using VBA.

ActiveProject.Tasks(1).Assignments(1).EnterpriseText1="test1"

ActivePRoject.Resources(1).Assignments(1).EnterpriseText1="test2"

John
Project MVP
 
W

www.projectserver.cz

..EnterpriseTextXY .... is only for backward compatibility with
project 2003. You can't change enterprise assignment field on MPS
2007 this way :)... .

Enterprise Assignment propery can't be changed from VBA code because
object Assignment do not contains methods SetField ang GetField, as
you can see here http://msdn2.microsoft.com/en-us/library/bb244360.aspx

Martin Winzig
 
J

John

www.projectserver.cz said:
.EnterpriseTextXY .... is only for backward compatibility with
project 2003. You can't change enterprise assignment field on MPS
2007 this way :)... .

Enterprise Assignment propery can't be changed from VBA code because
object Assignment do not contains methods SetField ang GetField, as
you can see here http://msdn2.microsoft.com/en-us/library/bb244360.aspx

Martin Winzig

Martin,
If the EnterpriseTextn property of an assignment object can't be
changed using VBA in a Project 2007 file, then why does the syntax I
provided in my second response work? Caveat: I don't use Project Server
so I cannot say for certain that it in fact works in that environment.

By the way, there are other ways to read and write object properties
than using SetField or GetField.

John
Project MVP
 
R

Rod Gill

Hi John,

From memory you don't have Project 2007 server to play with so I hope you
don't mind me stepping in. With Project Server 2007 custom fields you read
them in Project Professional using the Getfield method (only way).
Enterprisetext1 etc don't work for Project 2007 as all those custom fields
are gone (you can have unlimited named fields instead). Unfortunately as
there is no getfield method for Assignments, you can't have assignment
custom fields.

Looking at your original problem gobogo90, I'm afraid this is a small black
hole in Project 2007 VBA. There is no way to recover Assignment level data
for 2007 Enterprise custom fields. I believe it's a bug that Project
recorded an instruction for you doing it manually. Ideally the next release
will have a getfield method for Assignments.

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 
W

www.projectserver.cz

Hi John,

From memory you don't have Project 2007 server to play with so I hope you
don't mind me stepping in. With Project Server 2007 custom fields you read
them in Project Professional using the Getfield method (only way).
Enterprisetext1 etc don't work for Project 2007 as all those custom fields
are gone (you can have unlimited named fields instead). Unfortunately as
there is no getfield method for Assignments, you can't have assignment
custom fields.

Looking at your original problem gobogo90, I'm afraid this is a small black
hole in Project 2007 VBA. There is no way to recover Assignment level data
for 2007 Enterprise custom fields. I believe it's a bug that Project
recorded an instruction for you doing it manually. Ideally the next release
will have a getfield method for Assignments.

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
             http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
             http://projectservertraining.com/learning/index..aspx

---------------------------------------------------------------------------­-------------------------









- Show quoted text -

I told about this hole to Patrick M Conlan - so i belive that this
bug will be fixed in next sp.
 
R

Rod Gill

I'll push it thru the MVP channels as well

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx


----------------------------------------------------------------------------------------------------


Hi John,

From memory you don't have Project 2007 server to play with so I hope you
don't mind me stepping in. With Project Server 2007 custom fields you read
them in Project Professional using the Getfield method (only way).
Enterprisetext1 etc don't work for Project 2007 as all those custom fields
are gone (you can have unlimited named fields instead). Unfortunately as
there is no getfield method for Assignments, you can't have assignment
custom fields.

Looking at your original problem gobogo90, I'm afraid this is a small
black
hole in Project 2007 VBA. There is no way to recover Assignment level data
for 2007 Enterprise custom fields. I believe it's a bug that Project
recorded an instruction for you doing it manually. Ideally the next
release
will have a getfield method for Assignments.

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx

---------------------------------------------------------------------------­-------------------------









- Show quoted text -

I told about this hole to Patrick M Conlan - so i belive that this
bug will be fixed in next sp.
 
J

John

Rod Gill said:
Hi John,

From memory you don't have Project 2007 server to play with so I hope you
don't mind me stepping in. With Project Server 2007 custom fields you read
them in Project Professional using the Getfield method (only way).
Enterprisetext1 etc don't work for Project 2007 as all those custom fields
are gone (you can have unlimited named fields instead). Unfortunately as
there is no getfield method for Assignments, you can't have assignment
custom fields.

Looking at your original problem gobogo90, I'm afraid this is a small black
hole in Project 2007 VBA. There is no way to recover Assignment level data
for 2007 Enterprise custom fields. I believe it's a bug that Project
recorded an instruction for you doing it manually. Ideally the next release
will have a getfield method for Assignments.

Rod,
Your memory serves you right and thanks for stepping in. It's
interesting that I can read and write to Assignment spare text fields in
Project 2007 although they can't be displayed as a column in any view.
The fields must be disabled when in a Server environment only. Of course
without Server there is no reason to use Enterprise fields.

John
Project MVP
 
G

gobogo90

Thanks everyone! Great discussion.

Chris Boyd's blog reference worked. If you are using the VBA editor
in Pro the field name will not show up in the object list but type it
and you will be set.

Greg
 

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