Some columns of summary task can not roll up

Hi,


Please run the code below:
public class TestSubTaskWithoutResource {
private static SimpleDateFormat formatter2 = new SimpleDateFormat(“MM/dd/yy”);
public static void main(String[] args) throws ParseException {
FileInputStream fstream = null;
try {
// Create a stream object containing the license file
fstream = new FileInputStream(“Aspose.Tasks.lic”);
// Instantiate the License class
License license = new License();
// Set the license through the stream object
license.setLicense(fstream);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
fstream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Project asProject = new Project(“Empty_Project.mpp”);

asProject.set(Prj.START_DATE, formatter2.parse(“7/6/16 08:00:00”));
//asProject.set(Prj.FINISH_DATE, formatter2.parse(“12/30/02 08:00:00”));

asProject.setCalculationMode(CalculationMode.None);
Task subTask = asProject.getRootTask().getChildren().add(“Sub Task”);
Task f1 = subTask.getChildren().add(“Release 5.0”);
Date startDate = formatter2.parse(“7/6/16”);
Date finishDate = formatter2.parse(“7/6/16”);
f1.set(Tsk.START, startDate);
f1.set(Tsk.FINISH, finishDate);
f1.set(Tsk.DURATION, asProject.getDuration(1, TimeUnitType.Day));
f1.set(Tsk.WORK, asProject.getDuration(8, TimeUnitType.Hour));
f1.set(Tsk.ACTUAL_START, startDate);
f1.set(Tsk.ACTUAL_FINISH, startDate);
f1.set(Tsk.ACTUAL_DURATION, asProject.getDuration(0.5, TimeUnitType.Day));
f1.set(Tsk.PERCENT_COMPLETE, 50);
f1.set(Tsk.ACTUAL_WORK, asProject.getDuration(4, TimeUnitType.Hour));
f1.set(Tsk.PERCENT_WORK_COMPLETE, 50);
Task f2 = subTask.getChildren().add(“Release 5.0”);
f2.set(Tsk.START, startDate);
f2.set(Tsk.FINISH, finishDate);
f2.set(Tsk.DURATION, asProject.getDuration(1, TimeUnitType.Day));
f2.set(Tsk.WORK, asProject.getDuration(8, TimeUnitType.Hour));
f2.set(Tsk.ACTUAL_START, startDate);
f2.set(Tsk.ACTUAL_FINISH, startDate);
f2.set(Tsk.ACTUAL_DURATION, asProject.getDuration(0.5, TimeUnitType.Day));
f2.set(Tsk.PERCENT_COMPLETE, 50);
f2.set(Tsk.ACTUAL_WORK, asProject.getDuration(4, TimeUnitType.Hour));;
f2.set(Tsk.PERCENT_WORK_COMPLETE, 50);;
asProject.recalculate();
asProject.save(“test_sub_task_without_resource.mpp”, SaveFileFormat.MPP);
System.out.println(“ok”);
}
}


Why the "Duration" of "Sub Task" is "0 days" and "Actual Start", "Actual Finish" is "NA" and "%Complete" is "0%" ?

Best Regards!
zhencheng.guo

Hi Zhencheng,


Thank you for writing to Aspose support team again.

It is observed that you have set startDate and finishDate 7/6/16 which causes exception while using the following formatter. It causes the start date and finish date both to 7/6/16 00:00:00 which causes complications in the project, like when you set the task ‘f1’ start and finish date to this value, it causes issues.

<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>private static SimpleDateFormat formatter2 = new SimpleDateFormat(“MM/dd/yy hh:mm:ss”);

If I set start date to 7/6/16 08:00:00 and finish Date as 7/6/16 17:00:00, then Duration of sub task and %Complete is not zero. Similarly Actual Start and Finish dates are not NA.

Could you please review the code as per above suggestions and share the feedback again?

Hi kashif,


Please run the below code:

public class TestSubTaskWithResource {
private static SimpleDateFormat formatter2 = new SimpleDateFormat(“MM/dd/yy hh:mm:ss”);
public static void main(String[] args) throws ParseException {
FileInputStream fstream = null;
try {
// Create a stream object containing the license file
fstream = new FileInputStream(“Aspose.Tasks.lic”);
// Instantiate the License class
License license = new License();
// Set the license through the stream object
license.setLicense(fstream);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
fstream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Project asProject = new Project(“Empty_Project.mpp”);

asProject.set(Prj.START_DATE, formatter2.parse(“7/6/16 08:00:00”));
//asProject.set(Prj.FINISH_DATE, formatter2.parse(“12/30/02 08:00:00”));

asProject.setCalculationMode(CalculationMode.None);
com.aspose.tasks.Resource test1Resource = asProject.getResources().add(“test1”);
com.aspose.tasks.Resource test2Resource = asProject.getResources().add(“test2”);
com.aspose.tasks.Resource test3Resource = asProject.getResources().add(“test3”);

Task subTask = asProject.getRootTask().getChildren().add(“Sub Task”);
Task f1 = subTask.getChildren().add(“Release 5.0”);
Date startDate = formatter2.parse(“7/6/16 08:00:00”);
Date finishDate = formatter2.parse(“7/6/16 17:00:00”);
f1.set(Tsk.START, startDate);
f1.set(Tsk.FINISH, finishDate);
f1.set(Tsk.DURATION, asProject.getDuration(1, TimeUnitType.Day));
f1.set(Tsk.ACTUAL_START, startDate);
f1.set(Tsk.ACTUAL_WORK, asProject.getDuration(3, TimeUnitType.Hour));
ResourceAssignment ra1 = asProject.getResourceAssignments().add(f1, test1Resource);
ra1.set(Asn.START, startDate);
ra1.set(Asn.ACTUAL_START, startDate);
ra1.set(Asn.ACTUAL_WORK,
asProject.getDuration(1, TimeUnitType.Hour));
ResourceAssignment ra2 = asProject.getResourceAssignments().add(f1, test2Resource);
ra2.set(Asn.START, startDate);
ra2.set(Asn.ACTUAL_START, startDate);
ra2.set(Asn.ACTUAL_WORK,
asProject.getDuration(1, TimeUnitType.Hour));
ResourceAssignment ra3 = asProject.getResourceAssignments().add(f1, test3Resource);
ra3.set(Asn.START, startDate);
ra3.set(Asn.ACTUAL_START, startDate);
ra3.set(Asn.ACTUAL_WORK,
asProject.getDuration(1, TimeUnitType.Hour));
Task f1_1 = subTask.getChildren().add(“Top-Down Project Planning”);
f1_1.set(Tsk.START, startDate);
f1_1.set(Tsk.FINISH, finishDate);
f1_1.set(Tsk.DURATION, asProject.getDuration(1, TimeUnitType.Day));
f1_1.set(Tsk.WORK, asProject.getDuration(8, TimeUnitType.Hour));
f1_1.set(Tsk.ACTUAL_START, startDate);
f1_1.set(Tsk.ACTUAL_WORK, asProject.getDuration(4, TimeUnitType.Hour));
f1_1.set(Tsk.PERCENT_WORK_COMPLETE, 50);
asProject.recalculate();
asProject.save(“test_sub_task_with_resource.mpp”, SaveFileFormat.MPP);
System.out.println(“ok”);
}
}

I have set start date and finish date to 7/6/16 08:00:00 and 7/6/16 17:00:00, now the "Duration" is correct, but the "Actual Start", "Actual Finish" is still "NA" and "%Complete" is still "0%".

Best Regards!
zhencheng.guo

Hi Zhencheng,


Thank you for providing more details. Could you please make it sure that if you have sent the right image or not? Also please perform same steps (as done using Aspose.Tasks to achieve the required output) using Microsoft Project and send us the sample output MPP file as well for our reference. It will help us to compare the outputs and provide assistance accordingly.

Hi kashif,


I was sure that I sent the right image and performed same steps. The attachment is the output MPP file.

Best regards!
zhencheng.guo

Hi Zhencheng,


Thank you for providing more details. This issue is re-produced and logged under Id:TASKSJAVA-259 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-259) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by kashif.iqbal