Read Write Rate Scale Information

Read/Write RateScale Information for Resource Assignment Aspose.Tasks for Java API allows reading as well as writing Rate Scale information for a Resource Assignment. The Asn.RateScale property can be specified to achieve this as shown in the following code sample.

 1String dataDir = Utils.getDataDir(AssignmentCost.class);
 2        
 3Project project = new Project(dataDir + "New project 2013.mpp");
 4
 5Task task = project.getRootTask().getChildren().add("t1");
 6
 7Resource materialResource = project.getResources().add("materialResource");
 8materialResource.set(Rsc.TYPE, ResourceType.Material);
 9
10Resource nonMaterialResource = project.getResources().add("nonMaterialResource");
11nonMaterialResource.set(Rsc.TYPE, ResourceType.Work);
12
13ResourceAssignment materialResourceAssignment = project.getResourceAssignments().add(task, materialResource);
14materialResourceAssignment.set(Asn.RATE_SCALE, RateScaleType.Week);
15
16ResourceAssignment nonMaterialResourceAssignment = project.getResourceAssignments().add(task, nonMaterialResource);
17nonMaterialResourceAssignment.set(Asn.RATE_SCALE, RateScaleType.Week);
18
19project.save("output.mpp", SaveFileFormat.MPP);
20
21Project resavedProject = new Project("output.mpp");
22
23ResourceAssignment resavedMaterialResourceAssignment = resavedProject.getResourceAssignments().getByUid(1);
24System.out.println(resavedMaterialResourceAssignment.get(Asn.RATE_SCALE));
25
26// only material resource assignments can have non-zero rate scale value.
27ResourceAssignment resavedNonMaterialResourceAssignment = resavedProject.getResourceAssignments().getByUid(2);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.