Remaining Work and Actual Work not being summarized correctly


Remaining Work and Actual Work values are not summarizing correctly. The following code should produce a MPP file with a the Main Parent 1 task set to have 15 hours of Remaining Work and 5 hours of Actual Work. However, it’s showing as 18.3 hours of Remaining Work and 1.7 of Actual Work. Any ideas as to why? Am I doing something wrong? See code below, also I‘ve attached the template and sample output file.

Project project = new Project("New Project 2010.mpp");
project.Set(Prj.ScheduleFromStart, true);
project.Set(Prj.StartDate, DateTime.Now);
Task mainParent = project.RootTask.Children.Add("Main Parent 1");
mainParent.Set(Tsk.IsSummary, true);
mainParent.Set(Tsk.DisplayAsSummary, true);
mainParent.Set(Tsk.Uid, 1);
// Add new task and assign attribute value
Task parent1 = mainParent.Children.Add("New Task Parent 1");
parent1.Set(Tsk.IsSummary, true);
parent1.Set(Tsk.DisplayAsSummary, true);
parent1.Set(Tsk.Uid, 2);
Task parent2 = mainParent.Children.Add("New Task Parent 2");
parent2.Set(Tsk.Uid, 3);
Task child1 = parent1.Children.Add("New Task Child 1");
child1.Set(Tsk.Duration, project.GetDuration(1));
child1.Set(Tsk.Uid, 4);
Duration _budgetDuration = new Duration();
_budgetDuration = _budgetDuration.Convert(TimeUnitType.Hour);
child1.Set(Tsk.Work, _budgetDuration.Add(10));
Duration _actualDuration = new Duration();
_actualDuration = _actualDuration.Convert(TimeUnitType.Hour);
child1.Set(Tsk.ActualWork, _actualDuration.Add(5));
child1.Set(Tsk.Start, DateTime.Now);
Task parent3 = mainParent.Children.Add("New Task Parent 3");
parent3.Set(Tsk.IsSummary, true);
parent3.Set(Tsk.DisplayAsSummary, true);
parent3.Set(Tsk.Uid, 5);
Task child2 = parent3.Children.Add("New Task Child 2");
child2.Set(Tsk.Duration, project.GetDuration(1));
child2.Set(Tsk.Uid, 6);
child2.Set(Tsk.Work, _budgetDuration.Add(10));
child2.Set(Tsk.ActualWork, _actualDuration.Add(0));
child2.Set(Tsk.Start, DateTime.Now);
MPPSaveOptions mppSaveOptions = new MPPSaveOptions();
mppSaveOptions.WriteViewData = true;
//Save the project as MPP project file
project.Save("result.mpp", mppSaveOptions);

I’ve downloaded a trial version of 9.2.1 of which I have a temporary license for evaluation. I’m using VS 2010 and MS Project 2010.

Thanks, Calvin

Hi Calvin,

Thank you for writing to Aspose support team.

This issue is re-produced and is logged under Id: TASKS-34497 in our issue tracking system. You will be automatically notified once any update is available in this regard.

Hi Kashif,

In addition to my original post I’ve noticed that the Actual Work/Remaining Work and Regular Work fields are not recalculated correctly when I move a task from one position to another using the logic below. Would this be corrected in Task - 34497 as well or would you have to create a new task for this (of course if indeed you can recreate on your end)?

task = project.RootTask.Children.GetByUid(1);


Seems like the summarized values of where the task was moved from were not refreshed. Let me know if you need any additional details. I’ve included a document with screen shots of the before and after move.

Thanks, Calvin

Hi Calvin,

Support for recalculation of ActualWork and RemaingWork fields will be available in the upcoming version of Aspose.Tasks for .NET 9.3.0. It is due for release by the end of this week. We’ll update you here once the fix version is available for download.

The issues you have found earlier (filed as TASKS-34497) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.