Read Write Rate Scale Information

Effective management of resource assignments in project planning requires not only tracking costs and work but also adjusting the Rate Scale settings. The rate scale determines how resource costs are applied over time (per hour, per day, per week, etc.). With Aspose.Tasks for .NET you can programmatically read and modify this information, enabling flexible project automation and integration with financial systems.

Read/Write RateScale Information for Resource Assignment

Aspose.Tasks for .NET provides the ResourceAssignment class, which includes the RateScale property. This property controls how assignment rates are calculated and distributed across the project timeline.

The following example demonstrates how to read and update the RateScale property of a resource assignment. It loads an existing project file, accesses the assignment, modifies its rate scale, and saves the updated project.

 1Project project = new Project("New Project.mpp");
 2
 3Task task = project.RootTask.Children.Add("t1");
 4
 5Resource materialResource = project.Resources.Add("materialResource");
 6materialResource.Set(Rsc.Type, ResourceType.Material);
 7
 8Resource nonMaterialResource = project.Resources.Add("nonMaterialResource");
 9nonMaterialResource.Set(Rsc.Type, ResourceType.Work);
10
11ResourceAssignment materialResourceAssignment = project.ResourceAssignments.Add(task, materialResource);
12materialResourceAssignment.Set(Asn.RateScale, RateScaleType.Week);
13
14ResourceAssignment nonMaterialResourceAssignment = project.ResourceAssignments.Add(task, nonMaterialResource);
15nonMaterialResourceAssignment.Set(Asn.RateScale, RateScaleType.Week);
16
17project.Save("output.mpp", SaveFileFormat.MPP);
18
19project = new Project("output.mpp");
20
21ResourceAssignment materialResourceAssignment2 = project.ResourceAssignments.GetByUid(1);
22Console.WriteLine(materialResourceAssignment2.Get(Asn.RateScale));
23
24// only material resource assignments can have non-zero rate scale value.
25ResourceAssignment nonMaterialResourceAssignment2 = project.ResourceAssignments.GetByUid(2);

In this example, the code first retrieves the current RateScale value, then updates it to a new scale (for example, from per hour to per day). This is particularly useful when adapting project data for different reporting standards or resource billing agreements.

FAQ

Q: What is the RateScale property used for?

Q: Do I need Microsoft Project installed to read or update rate scales?

Q: Can I change the RateScale value and save it back to an MPP file?

Q: Does updating RateScale affect assignment costs?

Conclusion

In this article, we learned how to read and update the RateScale property of a resource assignment using Aspose.Tasks for .NET. By modifying rate scale values programmatically, developers can ensure consistency in financial reporting, adapt assignments for different billing methods, and integrate project data seamlessly into custom solutions.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.