method GetField and custom field created in EPM

A

alex

Hi,

Context:
I try to read a value from a custom column attached to each task.
I don't find the way to read the value of a custom column.
The custom column is a listbox filled by a table data from EPM.
So the name is "EQUIPEPERSONNALISEE".
When I try the code below, the program said, incompatibilty type.
I think it's because the argument is wrong.

Is there any way to get it?

###################################"
Code:
Sub test()

Dim T As Task
Dim i As Long

For Each T In ActiveProject.Tasks
If Not (T Is Nothing) Then
For i = 0 To 10
Set T = ActiveProject.Tasks(T.ID)
' Save the task name
If i = 0 Then
OldName = T.GetField("EQUIPEPERSONNALISEE")
SetTaskField Field:="EQUIPEPERSONNALISEE", Value:="Non
renseigné", TaskID:=T.ID
End If
Next i
End If
Next T
End Sub
###################################"

best regards,
Alexandre BARAULT

http://alexandrebarault.blogspot.com/
 
J

Jack Dahlgren

You could try:

Dim T as Task
For Each T In ActiveProject.Tasks
If Not (T Is Nothing) Then
T.EQUIPEPERSONNNALISEE="Non renseigné"
End If
Next i
End If
Next T


Otherwise, if that is not working try
T.SetField(Application.FieldNameToFieldConstant("EQUIPEPERSONNNALISEE",pjTask),"Non renseigné")

-Jack Dahlgren
 
A

alex

HI

Thank you for the answer.
I didn't think the intellisence wasn't updated.
So I don't see customField but it'working.

Thank you.

Best regards,
Alexandre BARAULT

http://alexandrebarault.blogspot.com/

Sub InitialiseEquipePersonnaliseeIDDI()
Dim T As Task
Dim mytest As Variant

For Each T In ActiveProject.Tasks
If Not (T Is Nothing) Then
If (T.EQUIPEPERSONNALISEE = "") Then
T.EQUIPEPERSONNALISEE = "Non renseigné"
End If
If (T.IDDI = "") Then
T.IDDI = "Non renseigné"
End If
End If
Next T
End Sub
 
A

alex

Hi,

I go more further.
I try to use the setfield and getfield but each time I obtain a compile error,
missing := and the compiler changes in red this line.
I respect the parameters so I don't know.
I try to change it but nothing works.
I suppose I did something wrong.

I appreciate an help.

I did a screenshoot you can see on the link below.
http://docs.google.com/Doc?id=dgq4sw2r_2059df5nwxdb

best regards,
Alexandre BARAULT
 
A

alex

Hi,

I find finally.
R.SetField FieldID:=pjResourceActualWork, Value:="43"

So if this can be usefull to someone.

best regards,
Alexandre BARAULT
 
A

alex

Hi,

I think I go to fast to say it's closed :(.

R.SetField FieldID:=pjResourceWork, Value:="444" => Execution error 1011
R.SetField FieldID:=Application.FieldNameToFieldConstant("Work", pjTask),
Value:="444" => Execution error 1011

What is wrong?

Best regards,
Alexandre BARAULT
 

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