PSI Resources

M

Malik Al-Shayeb

Hi

I want to ask one simple question , i want to create Material resources and
i want to set the standard rate for this resource or i want to loop through
the resources i already have and update the standard rate for them ,i tried
to look for the property RES_Cost or RES_StandardRate but i found nothing can
you help me with this please .

Best Regards
Malik Al-Shayeb
 
R

Rod Gill

Learnt this at the Project Conference. PSI can't edit rates so if you have a
large number of rates to adjust, open them for editing in Project Pro and
use a VBA macro to read the rates from something like Excel and update them
in Project. Much quicker and easier to write!

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com




Malik Al-Shayeb said:
Hi

I want to ask one simple question , i want to create Material resources
and
i want to set the standard rate for this resource or i want to loop
through
the resources i already have and update the standard rate for them ,i
tried
to look for the property RES_Cost or RES_StandardRate but i found nothing
can
you help me with this please .

Best Regards
Malik Al-Shayeb

__________ Information from ESET Smart Security, version of virus
signature database 4525 (20091020) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature database 4525 (20091020) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Stephen Sanderlin [MVP]

Rod and Malik,

To clarify, the PSI can edit rates but the way it has to be done differs
from the rest of the PSI.

This code, which you'd expect to work, does not:
Guid _sampleResUid = new
Guid("8e345885-f613-4f61-a49b-5fd22fa064fe");

// Retrieve existing resource data
ResourceSvc.ResourceDataSet _existingWorkRes =
_resourcePsi.ReadResource(_sampleResUid);

// Change rate to $250,000/yr
_existingWorkRes.ResourceRates[0].RES_STD_RATE =
120.19230769230769230769230769231;

// Update Resource
_resourcePsi.CheckOutResources(new Guid[] {_sampleResUid});
_resourcePsi.UpdateResources(_existingWorkRes, false,
false);
_resourcePsi.CheckInResources(new Guid[] {_sampleResUid},
false);

The row in ResourceRates is updated and any subsequent reads from the
PSI show the new rate, but Project Pro will still show the old rate.
In fact, if you check out the resource using Pro and save it, the new
rate you set is overwritten with the old rate.

In order to get this to work, you must run this code:
Guid _sampleResUid = new
Guid("8e345885-f613-4f61-a49b-5fd22fa064fe");

// Retrieve existing resource data
ResourceSvc.ResourceDataSet _existingWorkRes =
_resourcePsi.ReadResource(_sampleResUid);

// Change rate to $250,000/yr
_existingWorkRes.ResourceRates[0].RES_STD_RATE =
120.19230769230769230769230769231;

// Set the corresponding resource row as modified
_existingWorkRes.Resources[0].SetModified();

// Update Resource
_resourcePsi.CheckOutResources(new Guid[] {_sampleResUid});
_resourcePsi.UpdateResources(_existingWorkRes, false,
false);
_resourcePsi.CheckInResources(new Guid[] {_sampleResUid},
false);


The fix is to set the corresponding row in the Resources table as
modified -- then the PSI and Pro both show the new rate.

I touched on this in DM303 at the Project Conference in response to a
question, but didn't go into the workaround.

Regards,
Steve

--
Stephen Sanderlin, Project MVP
VP of Technology
MSProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com
 

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