• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

MPXJ problem

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I am trying to edit a MSPDI(xml) file through mpxj.

When I read the file programtically before editing the contants are:

Task name : Summary Task
Task Unique ID : 1
Task Unique ID : 1
Start Date : null
Finish Date : null
Duration : 0.0

Task name : First Sub Task
Task Parent Unique ID : 1
Task Unique ID : 2
Start Date : 01/01/2003
Finish Date : null
Duration : 10.5

Task name : Second Sub Task
Task Parent Unique ID : 1
Task Unique ID : 3
Start Date : 11/01/2003
Finish Date : null
Duration : 10.0

Task name : Milestone
Task Parent Unique ID : 1
Task Unique ID : 4
Start Date : 21/01/2003
Finish Date : null
Duration : 0.0

But when I edit the file using the code below:

==============================

MPXFile file = new MSPDIFile (filename);

file.setAutoTaskID(true);
file.setAutoTaskUniqueID(true);

file.setAutoOutlineLevel(true);
file.setAutoOutlineNumber(true);

file.setAutoWBS(true);
file.setAutoCalendarUniqueID(true);

LinkedList llist=file.getChildTasks();
Task milestone1 =(Task)llist.get(0);

Task task1 = milestone1.addTask();
task1.setName ("Added programaticaaly 3");
task1.setDuration (MPXDuration.getInstance (12, TimeUnit.DAYS));
task1.setStart (df.parse("17/03/2005"));

Task task2 = milestone1.addTask();
task2.setName ("Added programaticaaly 4");
task2.setDuration (MPXDuration.getInstance (12, TimeUnit.DAYS));
task2.setStart (df.parse("17/03/2005"));

file.write (filename);
=========================================

Now when I again read the file through the program the contents are

Task name : Summary Task
Task Unique ID : 1
Task Unique ID : 1
Start Date : null
Finish Date : null
Duration : 0.0


Task name : Added programaticaaly 3
Task Parent Unique ID : 1
Task Unique ID : 1
Start Date : 17/03/2005
Finish Date : null
Duration : 12.0


Task name : First Sub Task
Task Parent Unique ID : 1
Task Unique ID : 2
Start Date : 01/01/2003
Finish Date : null
Duration : 10.5


Task name : Added programaticaaly 4
Task Parent Unique ID : 1
Task Unique ID : 2
Start Date : 17/03/2005
Finish Date : null
Duration : 12.0


Task name : Second Sub Task
Task Parent Unique ID : 1
Task Unique ID : 3
Start Date : 11/01/2003
Finish Date : null
Duration : 10.0


Task name : Milestone
Task Parent Unique ID : 1
Task Unique ID : 4
Start Date : 21/01/2003
Finish Date : null
Duration : 0.0

Just wanted to know why are the Task Unique ID same for multiple tasks.

Shouldn't they be unique.

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic