Percentage Calculations
Contents
[
Hide
Show
]The PercentWorkComplete property exposed by the Resource class is used to manage the percentage of work a resource has completed. The PercentWorkComplete property represents the percentage of the work across all assignments a resource has completed. It supports the integer data type.
Getting Percentages with Aspose.Tasks
The following code example shows how to get the percentage of work completed by a resource against all the assignments using Aspose.Tasks for C++.
1// Create project instance
2System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"ResourcePercentWorkComplete.mpp");
3
4// Display work percentage completion for all resources
5
6{
7 auto res_enumerator = (project1->get_Resources())->GetEnumerator();
8 decltype(res_enumerator->get_Current()) res;
9 while (res_enumerator->MoveNext() && (res = res_enumerator->get_Current(), true))
10 {
11 if (res->Get<System::String>(Rsc::Name()) != nullptr)
12 {
13 System::Console::WriteLine(res->Get<int32_t>(Rsc::PercentWorkComplete()));
14 }
15 }
16}