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

Free Support Forum - aspose.com

'%Complete' and 'Actual Duration' are incorrect

Hi,


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
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 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);
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));
asProject.recalculate();
asProject.save(“test_create_actual.mpp”, SaveFileFormat.MPP);
System.out.println(“ok”);
}
}

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


Best Regards!
zhencheng.guo

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.