Assignment of resource Peak


#1

Hi,

I'm exporting an mpx file from my web app. and can create my tasks and assign my resources to each task. For each resource I use the following code:

Resource resource;
//cast resource from the aspose resource collection in the mpxfile and set properties
resource = (Resource)mpxFile.AllResourcesIdea [I];
resource.MaxUnits = 75.00;
resource.Peak = 75.00;
//assign resource
asposeTask.AddResourceAssignment(resource);

The resource is added to the resource assignments on the task fine but no matter what I set the Peak to, every resource has a unit of 100% when I view the task data in MS Project Pro 2003. The MaxUnits value works fine when I view the Resource Sheet in MS Project? Is there another property I have to set to make the Peak units appear?

Please can you advise on why this is happening as soon as possible please.

Many thanks in advance

Si


#2

The most simple way to check is create resource with correct MaxUnit in MS Project.
After that open it with Aspose.Tasks and check in debugger what properties are set.
Probably you should set some start or end dates… I will check it.


#3

Hi again,

For your information I set all the following on every task I create:

Name
Start
Finish
Duration
PercentComplete
ConstraintType
Type

Any Predecessors that the task may own and also the resources.

I have done the same in reverse, by that I mean importing an MPP file into my webpage and stepped through the code in the debugger. The Peak property is definitely what is set from MS Project when you give a resource say 80% in the units field of the TaskData dialogue.

Thanks

Si


#4

Hi,

Have you had any joy in solving this yet? It's really quite urgent.

Thanks in advance.

Simon


#5

Looks like Peak is calculated field and even if you assign any value to it
MS Project will recalculate and overwrite Peak when load project.


#6

Thanks for the reply but do you have a workaround?

There must be a way of allocating a resource at say 80% for one task and maybe 50% for another task. I can't see how or why MS Project would calculate this everytime you open a mpx file, there must be something which is not being set in the ASPOSE task object?? Being able to import resourcing is a fundamental part of how we need to use ASPOSE from our website.

I look forward to your reply.

Simon


#7

Let’s start from the beginning. What is Peak property? From MS Project VBA help:


Peak Property. Returns the largest number of resource units assigned for the assignment. Read-only Variant

PeakUnits Property. Returns the largest number of units of a resource used at one time. Read-only Double.


Both properties are read-only so you can’t change it in MS Project.

As I wrote MS Project recalculates it by itself and you can’t set it directly but…


For example you have two tasks and one resource and assigned this resource to both tasks.

ResourceAssignment has Units property which is number of used resource units.

Peak property should be equal to assignment1.Units + assignment2.Units.


So you can change Peak by changing Units of different resource assignments.


#8

Excellent - many thanks!!

It was unclear from your API reference exactly how I should have assigned a resource to a task. I didn't realise the AddResourceAssignment(Resource resource) method returned a ResourceAssignment object which could then have it's properties set.

Thanks again. Smile [:)]

Simon