Hi,
I’m trying to set the task completion using Aspose.Tasks for Java 22.9.
The following code works (sets the completion to 20%):
int p = 20;
task.set(Tsk.PERCENT_COMPLETE, p);
The following doesn’t (completion remains at 0%):
public int getCompletionPercentageInt() {...}
// returns some non-zero integer, e.g. 30
...
task.set(Tsk.PERCENT_COMPLETE, getCompletionPercentageInt());
What’s wrong using getCompletionPercentageInt()?
Shall the result be converted to some Aspose.Tasks specific type? Which one?
I haven’t found any suitable for and examples are not addressing this topic (at least I have not found any).
Regards
Many thanks for the effort to understand and evaluate the problem.
However, setting the PERCENT_COMPLETE for a task itself was not the problem.
It turned out that the problem was setting the completion to 0% for summary tasks (group tasks) what resulted in automatic resetting the completion for subtasks to 0%.
One may observe this behavior directly in MS Project. The Aspose.Tasks library appears to do it too.
The solution was to not set the completion for summary tasks.