Resource Groups

F

Finius Eetch

I'm building a reporting tool that currently exports data to HTML pages based
on custom discipline groups I've setup in the text 3 field. What i'm trying
to do now is extract the group information from the resource sheet and create
custom pages for each GROUP with the disciplines listed.

For example:
I have a resource named "Bob" who is a Physics Programmer.
I have a resource named "Jody" who is an Animation Programmer.
I have a resource named "Tony" who is a Tools Programmer.

I assigned Bob to the Physics Programmer custom text3 field I call Discipline.
Jody and Tony are assigned Animation and Tools respectively.

All of these resources are part of the 'Programming' Resource Group when I
look at Bob, Jody, and Tony under the resource sheet.

I can get a group name from my list by doing:
ActiveProject.Resources(some_number).Group. The problem with doing it this
way, it returns duplicate Group names which would suck since I'm generating
HTML pages for each group name as part of a loop.

I know I could grab,store, and test each resource group to see if I already
have that and build my own list, but there has to be an easy way to just give
me a list of my groups. Programming, Art, Audio, Design, Production.

This will allow me to format my data like this.

Programming
... Physics Programming
... Animation Programming
... Engine Programming
... Audio Programming
... Tools Programming

Design
... Designer
... Writer
... Scripter
... Scenario Editor

Art
... Animator
... Modeler
... etc
... etc.


Currently I'm able to generate custom pages for each 'discipline in the
group on one page since I don't take into account the 'parent' group. I want
to create the parent group with the disciplines listed under it.

In short, how can i get the specific list of ONLY the valid resource group
names?

Thanks,
Finius.
 
F

Finius Eetch

Rod,
When I apply the 'Resource Group' under the Resource Sheet, it does group
everything the way I want however I have a problem. I need to be able to
access that list of Resource Group names through VBA since I need to pass
those group names to other functions to generate my reports.

Basically, I want a function like this (below) that returns me Programming,
Art, Design, Production. Not the names of my group filters: No Group,
Resource Group, Standard Rate, etc.

Sub PopGroups()
Dim RG As Group
Dim Groups As String

For Each RG In ActiveProject.ResourceGroups
Groups = Groups & RG.Name & vbCrLf
Next RG

MsgBox Groups

End Sub

Thnx,
Finius
 
R

Rod Gill

The Group name is only a property, not an object with a collection. You will
need to loop through all resources and save the group name in an array, but
only if it's not there already (so you need to loop thru the array to see if
it is there), or experiment with VBA collections.

--

Rod Gill
Project MVP

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

Finius Eetch

I was hoping there would be a faster way. I figured I'd have to do it the
hard, and 'SLOW' way. Here's what I ended up with. Thanks again for your
help, with this problem and previous ones in the past.

Private Function Populate_Resource_Group_List() As Boolean
Dim Tasks_Counted As Integer
Dim the_entry As Integer
Dim the_loop As Integer
Dim check_loop As Integer
Dim BuildResourceGroupList(TOTAL_RESOURCE_GROUPS) As String
Dim temp As Variant

the_entry = 1
the_loop = 1
check_loop = 1

SelectAll

'How many tasks?
If ActiveCell.Task Is Nothing Then
Tasks_Counted = 0
Else
Tasks_Counted = ActiveSelection.Tasks.Count
End If


' Populate our list
Do

SelectTaskField Row:=the_loop, Column:="Resource Group",
RowRelative:=False ' Get the Resource Group column and set the row to 1

If (ActiveCell.Text <> "") Then ' If the cell is not blank
lets go see if we have it already.

Do
If (BuildResourceGroupList(check_loop) =
ActiveCell.Text) Then GoTo we_have_this ' If we have it goto we_have_this


' If not, we need to keep checking all entries.

check_loop = (check_loop + 1)

Loop Until check_loop > TOTAL_RESOURCE_GROUPS ' Once
we've check all 100 entries to see

BuildResourceGroupList(the_entry) = ActiveCell.Text
'Means we have a new one, so lets pop it in here.
the_entry = (the_entry + 1) 'Make room
for our next entry.

'temp = SaveFileHTML(BuildList(the_entry - 1), BuildList(the_entry - 1) &
"Export Map", 1, 0, 1, 1, 0)


End If


we_have_this:
check_loop = 0

the_loop = (the_loop + 1)
Loop Until the_loop > Tasks_Counted

End Function
 

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