Resource Usage by Task for Selected Tasks Only

P

ProModeler

I am creating a new combination view. It has the Gantt Chart in the top
pane, and the Resource Usage in the bottom pane. Currently, when I click on
a task in the Gantt Chart, the Resource Usage table shows a list of the
resources assigned to that task. However, under each resource name is the
entire list of tasks for that resource.

I would like only the tasks I have selected in the Gantt Chart to be listed
under each resource in the Resource Usage table. For example, if Task1 has
Resource1 assigned, and I select Task1, I want only Task1 to appear in the
task list under Resource1 in the Resource Usage table, even if Resource1 is
also assigned to Task2.

Is there a filter or group I could use to acheive this?

Thanks!
 
J

JulieS

Hello ProModeler,

To the best of my knowledge, no. A view showing at the bottom of a
combination view cannot be filtered. I am not sure what you want to
show by using the Resource Usage in the bottom pane. Would the Task
Usage view work?

I hope this helps. Let us know how you get along.

Julie
Project MVP

Visit http://project.mvps.org/ for the FAQs and additional information
about Microsoft Project
 
P

ProModeler

Task Usage has the same display behaviour as I want for Resource Usage;
however, when I use Task Usage, I do not get the functionality I need.
Perhaps if I can get the following functionality out of Task Usage...

I add a new column in the Task Usage table, and map it to the field name of
Text1. When I enter data into a cell in this column for the displayed task
row, it is entered into Task.Text29 field in the object model. If I enter
text into cell in the resource row for this column, I can't seem to figure
out where it is saved, but it is not in the Assignment.Text1 field, which I
would expect, and could really use.

Where is the text being saved in the object model for Text1 in a resource
row of the Task Usage view? Or, how can I save information to
Assignment.Text1 field in the Task Usage view?

BTW, I get Assignment.Text1 data in the Resource Usage view, however, I also
get all the extra tasks displayed as I previously posted.

Thanks! I really appreciate any help!

-ProModeler
 
J

JulieS

Hello ProModeler,

Okay, a few questions:

What version of MS Project are you using?

When you note that you are adding the field Text1 and then showing data
in Task.Text29, this isn't making sense. If you add the Text1 field to
the task usage view, the text should be appearing in Task.Text1, not
Text29. If you enter data into the Text1 field on the assignment row it
should appear in Assignment.Text1

Please explain what you mean by:
I add a new column in the Task Usage table, and map it to the field
name of
Text1. When I enter data into a cell in this column for the displayed
task
row, it is entered into Task.Text29 field in the object model

I hope this helps. Let us know how you get along.

Julie
Project MVP

Visit http://project.mvps.org/ for the FAQs and additional information
about Microsoft Project
 
P

ProModeler

Thanks for the reply. I appologize for the mix up with the Task29 vs. Task1.
I meant to type Task1 every time.

I am using Project 2007. When I enter data into Text1 for an assignment row
in the Task Usage view, it does not appear to put the information in
Assignment.Text1. I have tried looking at Task.Text1, Resource.Text1 and
Assignment.Text1, and cannot find the information I entered in the assignment
row for the Text1 column.

And to clarify, when I enter information in the assignment row for Text1 in
the Resource Usage table, I get the information back out in assignment1.Text,
but just not in the Task Usage table. Strange.

In case this information is useful, I am using the object model in a C#
application in Visual Studio 2005 with a reference to
Microsoft.Office.Interop.MSProject.

I loop through all of the assignments using:

using MSP = Microsoft.Office.Interop.MSProject;

foreach (MSP.Task task in tasks)
{
foreach (MSP.Assignment assignment in task.Assignments)
{
string test = assignment.Text1;
}
}

This returns the information entered in the cell if I use the Resource Usage
table, but not the Task Usage table. Could I be looking in the wrong
assignments or something similar?

Thanks!

ProModeler
 
J

JulieS

Thanks for the additional information that you are using Project 2007
that does make a difference as assignment data has changed from the
earlier releases to Project 2007. However, I think we can still get (I
hope) what you need.

In quick testing -- if I added the Text1 field to the *Task* Usage view
and populated the assignment row (showing resource name) with data, the
data appeared in the Assignment.Text1 field. I ran the code below to
test:

Sub ShowTaskAssignmentdata()
Dim tk As Task
Dim tks As Tasks
Dim Agn As Assignment
Set tks = ActiveProject.Tasks
For Each tk In tks
If Not tk Is Nothing Then
For Each Agn In tk.Assignments
Debug.Print Agn.Text1
Next Agn
End If
Next tk
End Sub

The immediate window shows the data entered into the assignment text1
field.

What is different in Project 2007, is that if you entered data into the
Text1 field added to the Resource Usage view on the assignment line, it
will show different data. Again, as a test -- I added the Text1 field
to the Resource Usage view. I expected to see the same assignment data
added for the Text1 field from the Task Usage view. Not so. In order to
see the Text1 data from the Resource Usage view, I needed the code
below:

Sub ShowresourceAssignmentdata()
Dim r As Resource
Dim rs As Resources
Dim Agn As Assignment
Set rs = ActiveProject.Resources
For Each r In rs
If Not r Is Nothing Then
For Each Agn In r.Assignments
Debug.Print Agn.Text1
Next Agn
End If
Next r
End Sub

Sorry, I don't know C# at all, but I assume the problem is that you
added data in the Assignment Text1 field while viewing the Resource
Usage view but are calling to Tasks in your code. Try adding to the
Assignment Text1 field while viewing the Task Usage view.


I hope this helps. Let us know how you get along.

Julie
Project MVP

Visit http://project.mvps.org/ for the FAQs and additional information
about Microsoft Project
 
P

ProModeler

Thanks for all your help! I believe I have found the following solution
based on the following issue with MS Project:

Try this, create a blank project with one task with one resource assigned to
it. Add the Text1 column to both Task and Resource Usage views. For the
assignments enter Asg1 in the Task Usage view and Asg2 in the Resource Usage
view (although, in theory, one would think that updating one would update the
other, but that doesn't appear to be the case).

Now when you execute either of the code examples you gave below, you will
get back Asg2, and not Asg1 for task assigments.

Now try the code that loops through the task assignments, but instead of
using the "foreach" enumeration loop, use the "for" indexer loop, and you
will get back Asg1.

I am not sure if this discrepancy between the enumerator and indexer is
intentional for task assignments, but my solution is to use a "for" loop and
not a "foreach" loop.

I was wondering if you knew why Text1 fields for Task Usage and Resource
Usage views do not sync when I edit one? The other one doesn't get updated,
although if I update other common columns, "Work" for instance, they update
each other.

Once again, thanks for all the help! I really appreciate it!

ProModeler
 
J

JulieS

You're most welcome for the help and thanks so much for the feedback.

I have tried the process you mention, one task, one resource (one
assignment) and I still get Asg1 when running the ShowTaskAssignmentdata
code and Asg2 when running the ShowresourceAssignmentdata code. *But*,
the important thing is that you have discovered a method that will work
for you :)

As to your question of "why" -- sorry, I haven't any idea. In previous
releases of Project, data manually entered into one of the assignment
custom fields (Text1-30, NumberX, etc) in the Task Usage View would show
the same data in the assignment custom field added to the Resource Usage
view. I don't know why the change was put in.

The Work field for assignments is a calculated field and will always
change if you change data because Project must maintain the mathematic
relationship between work, duration, and assignment units.

If you have further questions about accessing data in project through
code, I suggest posting to the developer newsgroup. There's quite a few
more code "gurus" there. (I'm certainly not a code guru -- just a mere
beginner :)

Julie
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