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

Free Support Forum - aspose.com

'%Complete' and 'Actual Duration' are incorrect


Please run the code below:
public class TestCreateActual {
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
} catch (FileNotFoundException e) {
} catch (Exception e) {
}finally {
try {
} catch (IOException e) {
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”));

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 f1 = asProject.getRootTask().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.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);
asProject.getDuration(1, TimeUnitType.Hour));
ResourceAssignment ra2 = asProject.getResourceAssignments().add(f1, test2Resource);
ra2.set(Asn.START, startDate);
ra2.set(Asn.ACTUAL_START, startDate);
asProject.getDuration(1, TimeUnitType.Hour));
ResourceAssignment ra3 = asProject.getResourceAssignments().add(f1, test3Resource);
ra3.set(Asn.START, startDate);
ra3.set(Asn.ACTUAL_START, startDate);
asProject.getDuration(1, TimeUnitType.Hour));
asProject.save(“test_create_actual.mpp”, SaveFileFormat.MPP);

Why the "%Complete" is "0%" and "Actual Duration" is "0"? I think the correct value is "12%" and "0.13".

Best Regards!

Hi Zhencheng,

Thank you for writing to Aspose support team again.

I have checked the scenario and observed that if we save project as XML, these values are correct as mentioned by you, however with MPP the values are wrong. This issue is logged under Id: TASKSJAVA-250 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

Hi Zhencheng,

We have prepared a hotfix version for this issue that you can download from this link: https://drive.google.com/open?id=0B3gm9pEry_NObllqbWwtenRxYzA . Please try it at your end and let us know your feedback.