Completing A Task

Hi,

I have a simple solution created where I have one parent task and two children. I’m setting the required properties, or at least at this point what I think needs to be set, and the output file is not entirely correct.
Scenario 2.zip (74.8 KB)
Scenario 3.zip (75.4 KB)
Scenario 1.zip (76.9 KB)

I’ve uploaded three sample solutions (Keep in mind that I have Project Calculation Mode set to “NONE” in all scenarios). Scenario 1 contains the entire solution and Scenario 2 and 3 only contain the template/generated output file and updated aspx.cs file:

In the Scenario 1 upload I’m only setting the task “Percent Work Complete” and “Percent Complete” values to be 100% for the “CHILD 2” task. In the generated project file it has no affect (meaning the task is not marked as complete…Actual Duration, Actual Work are 0 and the Actual Start and Finish is NA). What else should I be setting here to mark the task as complete?

In the Scenario 2 upload I’m setting the “Actual” and “Remaining” values (Actual Duration, Actual Work, Actual Start and Finish, Remaining Work and Remaining Duration) in addition to the percent complete fields in scenario 1. In the generated project file all values seem to be correct. At this point if I were to select the incomplete task “CHILD 1” and select the 100% button to mark the task as complete it doesn’t set the actual work or actual finish date values correctly (actual work remains at 0 and finish is set to NA). It seems like I’m not setting all the correct values via Aspose.Tasks that will facilitate the complete action in MS Project. Can you tell me what I’m missing here?

In the Scenario 3 upload in addition to setting all values in the previous two scenarios, I’m trying to add a resource to the CHILD 1 and CHILD 2 task. In the generated project file the finish date for the “CHILD 1” task is showing as 5:00 PM when the work value associated to the task is only 1 hr (since this task is schedule to start at 8:00 AM it should finish at 9:00 AM). All values displayed for the “CHILD 2” task seem to be correct at this point. If I were to perform a calculate project at this point, by selecting from the Project menu, the Actual Duration and Duration values are zeroed out for the completed task “CHILD 2”. If I then try to save I get the “The file cannot be opened.” error. It seems like project is expecting values that I’m not setting via code. Are you able to provide me with a working sample, where Aspose.Tasks is creating a parent task with two children of which one child is complete and both have a resource assigned?

I’m using Aspose.Tasks 17.1.0, VS 2010 and MS Project 2010. I’ve include my starting template in all uploads “blank.mpp” and the generated output file is “AsposeCompleteTaskIssue.mpp”.

If you need any further information, please let me know.

Thanks, Calvin

@calvin.howell,

We are looking into the issue. We will update you soon about our findings.

@calvin.howell,

Thank you for you patience.

You may please give a try to following sample code which generates output as desired by you. Give it a try and if the results in MPP differ than the expected one, please review the XML output also and share the feedback.

We have observed that using your template file, there is some issue while opening the resultant XML file. Please try the scenario with the template file Blank2010.mpp attached here.

Project proj = new Project(@"blank2010.mpp");
proj.CalculationMode = CalculationMode.None;
proj.Set(Prj.StartDate, new DateTime(2017, 7, 17, 8, 0, 0));

Resource res1 = proj.Resources.Add("Resource 1");
Resource res2 = proj.Resources.Add("Resource 2");
Task parent = proj.RootTask.Children.Add("PARENT");
Task child1 = parent.Children.Add("CHILD 1");
child1.Set(Tsk.Start, new DateTime(2017, 7, 17, 8, 0, 0));
child1.Set(Tsk.Finish, new DateTime(2017, 7, 17, 9, 0, 0));
child1.Set(Tsk.Duration, proj.GetDuration(1, TimeUnitType.Hour));

ResourceAssignment ra1 = proj.ResourceAssignments.Add(child1, res1);
ra1.TimephasedData.Clear();

Task child2 = parent.Children.Add("CHILD 2");
child2.Set(Tsk.Start, new DateTime(2017, 7, 17, 8, 0, 0));
child2.Set(Tsk.Finish, new DateTime(2017, 7, 17, 14, 0, 0));
child2.Set(Tsk.Duration, proj.GetDuration(5, TimeUnitType.Hour));

child2.Set(Tsk.ActualWork, proj.GetDuration(5, TimeUnitType.Hour));
child2.Set(Tsk.ActualStart, new DateTime(2017, 7, 17, 8, 0, 0));
child2.Set(Tsk.ActualFinish, new DateTime(2017, 7, 17, 14, 0, 0));
child2.Set(Tsk.ActualDuration, proj.GetDuration(5, TimeUnitType.Hour));

child2.Set(Tsk.PercentComplete, 100);
child2.Set(Tsk.PercentWorkComplete, 100);
ResourceAssignment ra2 = proj.ResourceAssignments.Add(child2, res2);
ra2.TimephasedData.Clear();

proj.Recalculate();

proj.Save(@"output.mpp", new MPPSaveOptions() { WriteViewData = true, RemoveInvalidAssignments = true });
proj.Save(@"output.xml", SaveFileFormat.XML);

Blank2010.zip (22.6 KB)

Hi Kashif,

Thanks for the quick response.

I’ve downloaded the latest release (17.7.0) as this is the only version where the ra1.TimephasedData.Clear() option is available and further simplified my example to match the code you’re provided (with a few minor differences surrounding the hard coding of the start and finish dates).

The issues I reported in Scenario 3 in my previous post have been alleviated. However, there still seems to be one more inconsistency with how Aspose is generating the output and the output when the same data is entered directly in MS Project.

I’ve attached my updated sample application for your review/testing. Once you execute the application, view the MS Project output file. Take notice that the Parent 1 Task has an Actual Finish date assigned that matches the CHILD 2 Actual Finish date (you’ll have to add these columns to your view). If you were to then preform a calculate project from the Project Menu the Actual Finish date on Parent 1 is reverted back to “NA”. If I were to manually enter in these three tasks in the Blank2010 MS project file, complete the Child 2 task only, the Parent 1 tasks Actual Finish Date remains as “NA”.

Can you tell me why the Parent 1 task Actual Finish date is being auto calculated when created by the sample application? Is there a way to prevent this?

Also, I’m using the Blank2010 template file that you’ve provided as well.

Thanks, Calvin
Scenario 3 Updated.zip (25.1 KB)

@calvin.howell,

We are further investigating the issue at our end and will soon write here to share our findings with you.

@calvin.howell,

I have observed the issue and logged it under Id: TASKSNET-2051 for further investigation by the product team. You will be notified once any update is received in this regard.

Hi Kashif,

Can you move this one to priority support for me?

Thanks, Calvin

@calvin.howell,

In order to get priority support, please open a ticket in Paid Support section with reference to the logged ticket id.

@calvin.howell,

This issue has been fixed in the latest release of Aspose.Tasks for .NET 17.8. Please feel free to write to us in case of any further query in this regard.

Hi,

The issue you reported here has been fixed in this latest version of Aspose.Tasks for .NET 17.11 that is available for download now.