0

I am trying to write a PMXML file using MPXJ 9.3.1 library. While generating the PMXML file, am setting the baseline dates for all tasks using the setBaselineStart and setBaselineFinish methods of the MPXJ Task class. But the generated PMXML file is using start and finish dates of each task as its corresponding baseline dates (PlannedStartDate and PlannedFinishDate).

 ProjectFile file = new ProjectFile();
      :
      :
 file.setBaseline(file, Task::getCanonicalActivityID);
      :
      :
 Task t = file.addTask()
 t.setBaselineStart(1, BASELINE_START_DATE)
 t.setBaselineFinish(1, BASELINE_FINISH_DATE)
     :
     :
 ProjectFile baseline = file.getBaselines().get(0);
 if(baseline != null) {
       ProjectProperties prop = file.getProjectProperties();   
        prop.setBaselineProjectUniqueID(baseline.getProjectProperties().getUniqueID()); 
      file.setBaseline(baseline, 1, t -> t.getCanonicalActivityID());
        
 }

writer.write(file,"path to file")

The above code is not helping in getting the right baselinedates in to the PMXML file. How do I get it to work ?

Patruni Srikanth
  • 741
  • 1
  • 7
  • 14

1 Answers1

0

MPXJ is modelled on the way Microsoft Project represents a schedule. For MS Project baselines are captured within the schedule itself using a "parallel" set of attributes (for example, the Cost attribute might also have Baseline 1 Cost, Baseline 2 Cost attributes, representing two distinct baselines). P6 takes a different approach allowing a snapshot of the entire schedule to be taken and linked as a baseline.

Currently MPXJ can make sense of this when reading a P6 schedule: you can read the primary schedule and the baseline schedule separately then use the ProjectFile.setBaseline() method to attach the baseline schedule to the primary schedule. This will automatically populate the baseline attributes for you in the primary schedule (for example, Baseline 1 Cost in the primary schedule would now be populated). MPXJ also automates this for you when reading PMXML files: if the relevant options have been selected when exporting the PMXML file so that the baseline schedule is included as part of the file, MPXJ will recognise this and set the baseline attributes for you in the primary schedule.

The situation is more complex when writing PMXML files. If you have a primary schedule file as a ProjectFile object, and you also have a baseline schedule represented as another ProjectFile object, you can use the ProjectFile.setBaseline() method to attach the baseline, then write the PMXML file. MPXJ will interpret this appropriately and write both the primary schedule and the baseline to the PMXML file. Unfortunately MPXJ does not currently provide any support for translating a single schedule containing the "parallel" set of baseline attributes described above (for example Baseline Cost 1, Baseline Cost 2) into a primary schedule and a baseline schedule suitable for writing to the PMXML file.

You can do this yourself, but care would be needed to ensure that the generated baseline schedule is valid and acceptable to P6 when imported. This is not an area I have invested any time in investigating.

Jon Iles
  • 2,519
  • 1
  • 20
  • 30