none
How copy the assignment value to the Task value? RRS feed

  • Question

  • I set a custom field for tasks. users update it by PWA. I Know,  it is  assignment value for the field.

    I want to roll-up this value to the task level, I need a macro to copy the assignment value to the Task value.

    I need this macro for two conditions:

    1. When I assign only one resource to each task.

    2. When you have more than one resource reporting on the task.

    Please Help me

    Friday, March 4, 2011 5:20 PM

Answers

  • Hi Mehdi,

    does your field name contain any " ", blank, space character? Then your only chance is to rename this field. If you give me your field name, I will change this macro accordingly and test it on my system.

    Regards
    Barbara

    Saturday, March 5, 2011 10:37 AM
    Moderator

All replies

  • Hi,

    hopefully you task field does not include any spaces? On assignment level, a macro can only read values, if there are no spaces in there. (This is no restriction for tasks and resources, but your field will have the same name for task and assignment ;-))

    This should do what you want, assuming that you want "sum" as roll-up function:

    Sub RollUp()

    Dim T As Task
    Dim A As Assignment

    For Each T In ActiveProject.Tasks
        If Not T Is Nothing And Not T.Summary Then
            vFieldValue = 0
            For Each A In T.Assignments
                vFieldValue = vFieldValue + A.<YourFieldName>
            Next A
            T.<YourFieldName> = vFieldValue
        End If
    Next T
    End Sub

    Does that help?
    Barbara

    Friday, March 4, 2011 5:46 PM
    Moderator
  • It works but when I use a Enterprise filed, On assignment level don't work

    Mehdi

    Saturday, March 5, 2011 10:31 AM
  • Hi Mehdi,

    does your field name contain any " ", blank, space character? Then your only chance is to rename this field. If you give me your field name, I will change this macro accordingly and test it on my system.

    Regards
    Barbara

    Saturday, March 5, 2011 10:37 AM
    Moderator