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

Free Support Forum - aspose.com

Clear all Actual of Project

Hi,


I want to clear all Actual of Project, but met some problem for that.
I attached the MPP file, can you help me to clear all the Actual of Project and save as the file? Can you give the example code?

Hi Zhencheng,


Thank you for contacting Aspose support team.

We are working on this issue and require further assistance. It seems that you have sent us empty zip file. Could you please send us the sample MPP again for our testing here? It will help us to analyze the requirement and provide assistance accordingly.

Hi Kashif,


I attached the MPP file, thanks for your help.

Have there been any fresh developments of this issue?

Hi Zhencheng,


We are analyzing this requirement and request you to spare us little time to complete the analysis. We will write back soon once the feedback is ready to share.


OK, look forward your reply.

Hi Zhencheng,


We have tried to clear all the actual fields in the sample project file but faced few problems. This issue is logged under Id:TASKSJAVA-218 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

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


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

Hi,


Could you show me an example to how to clear all the actual? Thanks!

Best Regards!
zhencheng.guo

Hi,


Please try the following code sample for this purpose. Please note that:

1) It is required to clean not just Tsk.ActualWork, but also Asn.ActualWork, because ResourceAssignments properties are used in Project.recalculate method.

2) You need to set CalculationMode.None in order to avoid ActualWork recalculation in each loop’s iteration.


Sample Code:

Project proj = new Project(“input.mpp”);
proj.setCalculationMode(CalculationMode.None);
ChildTasksCollector collector = new ChildTasksCollector(); // Create a ChildTasksCollector instance
TaskUtils.apply(proj.getRootTask(), collector, 5); // Collect all the tasks from RootTask using TaskUtils
for (Task tsk : collector.getTasks())
{
tsk.set(Tsk.ACTUAL_WORK, proj.getDuration(0));
for (ResourceAssignment assignment : tsk.getAssignments())
{
assignment.set(Asn.ACTUAL_WORK, proj.getDuration(0));
}
tsk.set(Tsk.ACTUAL_DURATION, proj.getDuration(0));
tsk.set(Tsk.PERCENT_COMPLETE, 0);
tsk.set(Tsk.PERCENT_WORK_COMPLETE, 0);
tsk.set(Tsk.PHYSICAL_PERCENT_COMPLETE, 0);
}
proj.recalculate();

Hi kashif,


The “Actual Start” and “Actual Finish” still has value, how to clear them?
Please see the attachment.

Best Regards!
zhencheng.guo



Hi zhencheng,


Thank you for providing the feedback. We have forwarded it to product team and will write back soon once the comments are provided.

Thank you for being patient in this regard.

Hi Kashif,


Just in case it can help, we’ve found a couple of things on cleaning actuals with Aspose:

1) You can empty the Actual Finish date field by setting percent complete to any value other than 100%

2) When we set percent complete to 0%, it will NOT empty the Actual Start field (it should, that’s how it works in MSP)

3) If the task has some assignments and a % complete value between 1% and 99%, it will NOT work to set percent complete to 0%. However, if we first set the value to 100% and then set it to 0%, it will work. There’s no such problem for tasks without assignments.

We still haven’t found a way to remove Actual Start dates.

Hi Etienne,


Thank you for providing the comments. I have passed it to the product team for their reference.