The issue about "%complete"

Hi,

Please run the code below, there are two issues:
1. The first task(summary task) have not roll up automatically, the "Start", "Finish" and so on are empty.
2. The second task(leaf task), the "Work" is 16 hours, and it has two Resources, and one Actual Work is 4 hours, and another one Actual Work is 2 hours, add up to 6 hours, the "complete" should be 38%( 6/16), why the "%complete" is 50%?


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");

// Task with assignments
Task task1 = asProject.getRootTask().getChildren().add("Double assignments rollup (0% complete)");
Task taskSub1 = task1.getChildren().add("16 hours work");

taskSub1.set(Tsk.START, formatter2.parse("1/3/05 08:00:00"));

taskSub1.set(Tsk.DURATION, asProject.getDuration(1, TimeUnitType.Day));

Resource elo = asProject.getResources().add("elo");
ResourceAssignment raElo = asProject.getResourceAssignments().add(taskSub1, elo);
raElo.set(Asn.START, formatter2.parse("1/3/05 08:00:00"));
raElo.set(Asn.WORK, asProject.getDuration(8, TimeUnitType.Hour));
raElo.set(Asn.ACTUAL_START, formatter2.parse("1/3/05 08:00:00"));
raElo.set(Asn.ACTUAL_WORK, asProject.getDuration(4, TimeUnitType.Hour));
Resource dwang = asProject.getResources().add("dwang");
ResourceAssignment raDwang = asProject.getResourceAssignments().add(taskSub1, dwang);
raDwang.set(Asn.START, formatter2.parse("1/3/05 08:00:00"));
raDwang.set(Asn.WORK, asProject.getDuration(8, TimeUnitType.Hour));
raDwang.set(Asn.ACTUAL_START, formatter2.parse("1/3/05 08:00:00"));
raDwang.set(Asn.ACTUAL_WORK, asProject.getDuration(2, TimeUnitType.Hour));

asProject.recalculate();
// Save the Project
asProject.save("output_test9.mpp", SaveFileFormat.MPP);

System.out.println("ok");
}

Hi Zhencheng,


Thank you for writing to Aspose support team. We are working on this issue and need further assistance in this regard. Could you please send us a sample MPP file, generated by Microsoft Project, which contains the above mentioned tasks with the exact data mentioned in the code. It will help us to provide assistance.

Hi kashif,


I attached two files, one is the “Empty_Project.mpp”, another is the “output_test9.mpp”.
The “output_test9.mpp” is the output result after run the code above I provided.

zhencheng.guo
Best Regards!

Hi Zhencheng,


Thank you for sending us the sample file.

I have used your sample code along with Aspose.Tasks for Java 9.4.1 and opened the resultant file in parallel to your sample output file which you have sent. It is observed that both the files have same %Work Complete = 38%. Here a comparison snapshot is given for your reference. Please give a try to your sample code again with the latest version of Aspose.Tasks for Java 9.4.1 and share the feedback.

Hi Kashif,



Why the “%Complete” is 50%? I think it should be 38%.

zhencheng.guo
Best Regards!

In additional, I can not find the version of Aspose.Tasks for Java 9.4.1,

the lastest version is 9.4.0.

Hi Zhencheng,


Yes, you are right, the latest Java version of Aspose.Tasks is 9.4.0. Thank you for the correction.Regarding the calculation of %Complete it uses following formula as mentioned here.

<span style=“color: rgb(47, 47, 47); font-family: “Segoe UI”, “Segoe UI Web”, “Segoe UI Symbol”, “Helvetica Neue”, “BBAlpha Sans”, “S60 Sans”, Arial, sans-serif; font-size: 16px; line-height: 24px; background-color: rgb(255, 255, 255);”>Percent Complete = (Actual Duration / Duration) * 100
<span style=“color: rgb(47, 47, 47); font-family: “Segoe UI”, “Segoe UI Web”, “Segoe UI Symbol”, “Helvetica Neue”, “BBAlpha Sans”, “S60 Sans”, Arial, sans-serif; font-size: 16px; line-height: 24px; background-color: rgb(255, 255, 255);”>

Hi Kashif,

Please run the code abvoe again.

Please see the second task(leaf task), the "Work" is 16 hours, and it has two Resources, and one Work is 8h, Actual Work is 4h, and another one Work is 8h,Actual Work is 2h, the total Actual work is 6h, so the Actual Druation shoud be 0.375 day, why the Actual Duration is 0.5 day?

Hi Zhencheng,


If we open the resultant file and see the Duration and %Complete, these are 1 day and 50%. Now actual duration is calculated as mentioned here. Please feel free to write us back if you have any other query related to Aspose.Tasks.

<span style=“color: rgb(47, 47, 47); font-family: “Segoe UI”, “Segoe UI Web”, “Segoe UI Symbol”, “Helvetica Neue”, “BBAlpha Sans”, “S60 Sans”, Arial, sans-serif; font-size: 16px; line-height: 24px; background-color: rgb(255, 255, 255);”>Actual Duration = Duration * Percent Complete
Hi kashif,

Percent Complete = (Actual Duration / Duration) * 100
Actual Duration = Duration * Percent Complete

From above we can conclude that the "Percent Complete" dependency on "Actual Duration", and "Actual Duration" also dependency on "Percent Complete", this is endless loop. What do you think?

Hi Zhencheng,

I have tried to re-produce the difference between the results created by Aspose.Tasks and MSP 2010 in Percent Complete calculation but could not succeed. The results were shared with you here where the calculations performed by the API and MSP were same. Could you please perform same steps (as in the above code sample) using MSP 2010 and provide us the difference in results created by Aspose.Tasks and MSP? Till now I have provided you the formulas which are provided by Microsoft Windows to calculate the Percent Complete value. As both the calculation results were same so I could not figure out any error in API calculations.

Once you provide us the difference in calculations performed by Aspose.Tasks and MSP, we will be in better position to provide you further assistance.