Set task ismanual to true- result in take long adding tasks

Hi

I have a tree of tasks and want to import to ms project programmatically with iterating my tree.
If set IsManual = true for every task in iterating, adding tasks and setting Task Start and Duration take a long time(e.g. 5 minute for 100 tasks). but if I dont set IsManual=true, it adds tasks very soon. where is the problem?

Hi Haamiid,


Thank you for posting your inquiry.

Could you please share your sample input data and code that you are trying at your end? Ideally, it shouldn’t take much time for adding this much data. Also, please try setting the project mode to None before adding data and then recalculate at the end when you are done with adding data. Let us know your feedback with requested data and sample code to get further assistance in this regard.

hi kashif,

many thanks! with your advice, problem solved.

You are welcome.

hi,

I have a problem with calcuation mode “none”. when I recalculate the project, all the task start date will be the project start date, even when I set tasks start date different, and no link(predecesor) are declare between tasks. I want recalculate has no effect on tasks start date.
thanks.

Hi Haamiid,


You may please use ConstraintDate and ConstraintType to set the desired data. Please give a try to the following sample code and share the feedback.




Project asProject = new Project(@“Empty_Project.mpp”);

asProject.Set(Prj.StartDate, new DateTime(2017, 2, 6, 8, 0, 0));

asProject.CalculationMode = CalculationMode.None;



Aspose.Tasks.Task f01 = asProject.RootTask.Children.Add(“Task 1”);

f01.Set(Tsk.Start, new DateTime(2017, 2, 6, 8, 0, 0));

f01.Set(Tsk.Finish, new DateTime(2017, 2, 10, 17, 0, 0));

f01.Set(Tsk.Duration, asProject.GetDuration(5, TimeUnitType.Day));

f01.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);

f01.Set(Tsk.ConstraintDate, new DateTime(2017, 2, 6, 8, 0, 0));



Aspose.Tasks.Task f02 = asProject.RootTask.Children.Add(“Task 2”);

f02.Set(Tsk.Start, new DateTime(2017, 2, 13, 8, 0, 0));

f02.Set(Tsk.Finish, new DateTime(2017, 2, 17, 17, 0, 0));

f02.Set(Tsk.Duration, asProject.GetDuration(5, TimeUnitType.Day));

f02.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);

f02.Set(Tsk.ConstraintDate, new DateTime(2017, 2, 13, 8, 0, 0));


Aspose.Tasks.Task f03 = asProject.RootTask.Children.Add(“Task 3”);

f03.Set(Tsk.Start, new DateTime(2017, 2, 20, 8, 0, 0));

f03.Set(Tsk.Finish, new DateTime(2017, 2, 24, 17, 0, 0));

f03.Set(Tsk.Duration, asProject.GetDuration(5, TimeUnitType.Day));

f03.Set(Tsk.ConstraintType, ConstraintType.StartNoEarlierThan);

f03.Set(Tsk.ConstraintDate, new DateTime(2017, 2, 20, 8, 0, 0));


asProject.Recalculate();


asProject.Save(“output.mpp”, SaveFileFormat.MPP);

thanks kashif,

But I dont want to declare constraints. Is there any way in calculationMode “none” to persist start date and end date explicitly? or is any way to create automatic tasks very fast, and for tasks without links, perform explicit set of start date and end date?

Hi Haamiid,


There is no such option in CalculationMode “none” which can be used to persist the start date and end date explicitly. This calculation mode none is provided for performance purposes and is better option as compared to Automatic mode while adding huge number of tasks.

Please feel free to write us back if you have any other query related to Aspose.Tasks.