Calculating a summary of resource group

D

dave

Hi All,
How would I access or calculate a 'resource group' summary for a certain
time period? Does project store these values anywhere or would VBA be
needed?

Dave
 
J

Jan De Messemaeker

Hi,

If you have 2002 or 2003, you can use the grouping feature to do exactly
that.
2000 does not totalize timescaled values.
HTH
 
D

dave

Hi Jan,

Thank for the reply.
I've MsProject 2002. I have used grouping. It does readily displays
summary values. What I would like do is use the group summary value in
another calculation.
Here is my example:
We use several material items in a month time. The purchasing of those
items must happen several weeks in advance of the use. I would like to
create a task for the procurement of those items. The frequency of the
task(s) would be based on the use and ordering best practises. I already
know the ordering best practises. The amount of use would be calculated
within MsProject using 'group summary values' How would I access this data?
Does MsProject store summary data in a special field or would I need to use
a vba method?
Dave
 
D

dave

Hi Jan

I've figure out how to call a group using
ActiveProject.ResourceGroups("TheThingGrouped").GroupCriteria(1).Ascending =
False

But how would I calculate the group value of the Work? Any suggestions
would be appreciated.

Dave
 
J

Jan De Messemaeker

Hi Dave,

The sad truth is I do not know.
I've been looking at the objects available but did not find a groupsummary
object that I could read the values of.

Having given up on that, I would calculate it myself looping through all the
tasks or resources and making a total for each group value... tedious
programming.

Sorry :-((
 
D

dave

Hi Jan,

Thanks for the reply,

I was hopefull for a easy solution. The calculating the total of a group
using a loop sounds difficult.. Any points would be helpful.

Dave
 
J

JackD

I'd just write something like this

Sub resourceGroupTotal()
Dim grouptotal As Long
grouptotal = 0
For Each Resource In ActiveProject.Resources
If Resource.ResourceGroup = "foo" Then
grouptotal = grouptotal + Resource.Work
End If
Next Resource
MsgBox "Foo Group Work = " & grouptotal
End Sub

Now if you want to go a bit further, you could build an array which holds
each unique value in the resource group field and then cycle through that. I
posted some code about building an array just last week, so if you dig that
up and put the two together you are 99% of the way there.
 
J

JackD

http://groups.google.com

But I have found it for you:
http://groups.google.com/groups?q="[email protected]&rnum=4

Here it is, posted Nov. 17th, 2004

This gets the values that exist in the text20 field and puts them into an
array.
I'm cutting and pasting from an old file, so I'm not 100% sure this is the
best version. I think it may end up with an extra value in the array, but
you can figure that out.
I usually call it from another subprocedure and then traverse the resulting
array.

------snip-----------


Private Sub MyArray()
Dim myTask As Task
Dim myTasks As Tasks
Dim Addme As Boolean
Dim myList As String

Set myTasks = ActiveProject.Tasks
ArrayIndex = 0
ReDim Preserve WorkType(ArrayIndex)
For Each myTask In myTasks
Addme = False
If Not myTask Is Nothing Then
If Not myTask.summary Then
If myTask.Text20 <> "" Then
Addme = True
'check if it is already in the array
For ArrayIndex = 0 To UBound(WorkType)
If myTask.Text20 = WorkType(ArrayIndex) Then
Addme = False
End If
Next ArrayIndex
End If
'if it is not in the array then expand the array and add the new value
If Addme = True And myTask.Text20 <> "" Then
WorkType(ArrayIndex - 1) = myTask.Text20
ReDim Preserve WorkType(ArrayIndex)
End If
End If
End If
Next myTask
End Sub

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

-
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
 

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