Read Write Rate Scale Information

Read/Write RateScale Information for Resource Assignment

Aspose.Tasks for C++ API allows to read as well as write Rate Scale information for a Resource Assignment. The Asn.RateScale property can be specified to achieve this as shown in the following code example.

 1System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"New project 2013.mpp");
 2    
 3auto task = project->get_RootTask()->get_Children()->Add(u"t1");
 4    
 5auto materialResource = project->get_Resources()->Add(u"materialResource");
 6materialResource->Set<ResourceType>(Rsc::Type(), Aspose::Tasks::ResourceType::Material);
 7    
 8auto nonMaterialResource = project->get_Resources()->Add(u"nonMaterialResource");
 9nonMaterialResource->Set<ResourceType>(Rsc::Type(), Aspose::Tasks::ResourceType::Work);
10    
11auto materialResourceAssignment = project->get_ResourceAssignments()->Add(task, materialResource);
12materialResourceAssignment->Set<RateScaleType>(Asn::RateScale(), Aspose::Tasks::RateScaleType::Week);
13materialResourceAssignment->Set<int32_t>(Asn::Uid(), 1);
14    
15auto nonMaterialResourceAssignment = project->get_ResourceAssignments()->Add(task, nonMaterialResource);
16nonMaterialResourceAssignment->Set<RateScaleType>(Asn::RateScale(), Aspose::Tasks::RateScaleType::Week);
17nonMaterialResourceAssignment->Set<int32_t>(Asn::Uid(), 2);
18    
19project->Save(dataDir + u"output.mpp", Aspose::Tasks::Saving::SaveFileFormat::MPP);
20    
21auto resavedProject = System::MakeObject<Project>(dataDir + u"output.mpp");
22    
23auto resavedMaterialResourceAssignment = resavedProject->get_ResourceAssignments()->GetByUid(1);
24System::Console::WriteLine(System::ObjectExt::Box<RateScaleType>(resavedMaterialResourceAssignment->Get<RateScaleType>(Asn::RateScale())));
25    
26// only material resource assignments can have non-zero rate scale value.
27auto resavedNonMaterialResourceAssignment = resavedProject->get_ResourceAssignments()->GetByUid(2);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.