We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create split tasks

Hi,

I am trying to create split tasks but my efforts so far have failed. I am using the following code. This is based on code I found on your support forum. Can you please review and show me where I’m going wrong?


An interesting behavior I’ve noted is I can split tasks within the initial mpp template, but once I use this template and save it as a new mpp file, I can no longer split tasks. Maybe this will help you isolate what I’m doing wrong?


Thanks in advance…


Project _project = new Project("c:\\temp\\splitTemplate.mpp");

Aspose.Tasks.Calendar calendar = _project.Get(Prj.Calendar);

_project.Set(Prj.StartDate, new DateTime(2014, 4, 30, 8, 0, 0));

//Add a new task

Aspose.Tasks.Task taskToSplit = _project.RootTask.Children.Add("Activity1");

taskToSplit.Set(Tsk.Start, new DateTime(2014, 4, 30, 8, 0, 0));

taskToSplit.Set(Tsk.Duration, _project.GetDuration(40.00, TimeUnitType.Hour));

DateTime calFinishDateTime = calendar.GetFinishDateByStartAndWork(taskToSplit.Get(Tsk.Start), taskToSplit.Get(Tsk.Duration));

taskToSplit.Set(Tsk.Finish, calFinishDateTime);

taskToSplit.Set(Tsk.DurationFormat, TimeUnitType.Day);

//Create a new resource assignment

ResourceAssignment splitResourceAssignment = _project.ResourceAssignments.Add(taskToSplit, null);

splitResourceAssignment.Set(Asn.Start, taskToSplit.Get(Tsk.Start));

splitResourceAssignment.Set(Asn.Finish, taskToSplit.Get(Tsk.Finish));

//Generate resource assignment timephased data

splitResourceAssignment.TimephasedDataFromTaskDuration(calendar);

//Split the task into 2 parts.

splitResourceAssignment.SplitTask(new DateTime(2014, 5, 1, 8, 0, 0), new DateTime(2014, 5, 1, 17, 0, 0), calendar);

splitResourceAssignment.Set(Asn.WorkContour, WorkContourType.Contoured);

string file = "c:\\temp\\SplitTest.mpp";

MPPSaveOptions options = new MPPSaveOptions();

options.WriteViewData = true;

_project.Save(file, options);

Hi Ian,


Thank you for writing to Aspose support team

An empty project is initiated without using any template project. Then a task is created, split and saved as XML. This XML is opened in MSP and splitting is fine.

However we have observed issue where a template project is used to initiate the Project object, a task is created, split and saved as MPP. This MPP is opened in MSP and issue is observed as shown in the attached image.

This issue is logged under Id: TASKSNET-1604 for further investigation by the product team. You will be automatically notified once any update is received in this regard.


Hi K<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-AU;mso-fareast-language:
EN-AU;mso-bidi-language:AR-SA”>ashif,


Are you able to estimate the probable delivery time for the fix for this bug?

Thanks
Ian

Hi Ian,


We fix issues on first come first serve basis. However, resolution of an issue may take time if it involves complexity and it can effect the resolution of other issues due to this. Usually, we try to fix issues reported with one version of the API in the next upcoming but it is subject to the complexity involved. We’ll update you here as soon as a fix version or any other information is available in this regard.

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


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