joniles / mpxj

Primary repository for MPXJ library

Home Page:http://www.mpxj.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remaining duration for Tasks with ActualStart time changes to 0 when writing back to XER file

iMohannad opened this issue · comments

Hi,

I am trying to process XER file that has Actual Start and Actual Duration for some tasks. However, if I write the project to XER file back without doing any changes to these tasks, remaining duration becomes 0.

How can I solve this issue? Is this an issue with me handling the tasks (even though I am not processing or changing these tasks)?

just to give an example on this. I tried to read a project using this function:

public ProjectFile readProject()
        {
            PrimaveraXERFileReader reader = new PrimaveraXERFileReader();
            ProjectFile project = reader.read(Path.Combine(filePath, fileName));
            return project;
        }

and then pass the output of this function to this function:

public void writeProject(ProjectFile project)
        {
            PrimaveraXERFileWriter writer = new PrimaveraXERFileWriter();
            string fileName = Path.GetFileNameWithoutExtension(this.fileName);
            string outputFile = fileName + "-output.xer";
            string filePath = Path.GetDirectoryName(this.filePath);
            writer.write(project, Path.Combine(filePath, outputFile));
        }

I still get the remaining duration of any progressed task to be 0.

Hello! I've had a quick go at reproducing this with a random XER file: for the activity I selected which had an actual duration and a remaining duration, the new record in the XER file written by MPXJ looks to be identical. I'm using the latest version (12.3.0) to try this. Would you be able to attach or send me a sample XER file and indicate an activity for which you are seeing this behaviour? Thanks!

Thank you for getting back to me on this issue.
I am using the source code directly from the library and I am on this commit b72cca805b1b9de97f16f071aa which is the latest one.

You may find attached the input .xer file and output xer file which has remaining duration for tasks with progress = 0 (it should be 18).

ActualXERFile.zip

Thanks for the sample files.

I wrote some code to look at he problem: https://github.com/joniles/mpxj-java-samples/blob/main/src/main/java/org/mpxj/tasks/TaskSamples.java#L38

Here's the output I get for the two files you provided:

Case3-Actuals.xer
ID	ActualStart	ActualDuration	RemainingDuration
1	2011-05-09T00:00	16.0h	46.0h
2	2011-05-09T00:00	8.0h	0.0h
3	2011-05-10T00:00	8.0h	18.0h
4	null	null	28.0h
5	null	null	44.0h
6	null	null	36.0h

Case3-Actuals-output.xer
ID	ActualStart	ActualDuration	RemainingDuration
1	2011-05-09T00:00	16.0h	46.0h
2	2011-05-09T00:00	8.0h	0.0h
3	2011-05-10T00:00	8.0h	18.0h
4	null	null	28.0h
5	null	null	44.0h
6	null	null	36.0h

(sorry the alignment isn't great - it's tab separated output)

It looks like the output is identical - am I looking at the right attributes?

Thank you for getting back to me with this example.
You are correct, I tried the same example and I get the same output. However when I try to open the file using P6, I get different view. Mainly for Task 3 where the remaining duration is 18.0h, it's changed to 0h.

Here's a picture that shows the comparison between the two files:
image

Is there something that is being written on the file that makes these two file shows different values for remaining duration where actual start is set?

Apologies for the delay in responding, just a quick note to confirm that I'm working on this.

I believe I have fixed the issue, the relevant changes will be in the next MPXJ release.