Menu

#197 Writing outline codes

open
Jon Iles
None
5
2016-09-09
2012-03-28
Anonymous
No

Hi,

it would be really cool if MPXJ would support OutlineCodes in the way that MS Project needs!
As far as i can see, MPXJ provides some setters/getters for outline codes, but the resulting xml files do not fit to the MSPDI schema:

<Project xmlns="http://schemas.microsoft.com/project">
..
<ExtendedAttributes>
<ExtendedAttribute>
<FieldID>188744096</FieldID>
<FieldName>Outline Code1</FieldName>
</ExtendedAttribute>
</ExtendedAttributes>
..
<Tasks>
<Task>
..
<ExtendedAttribute>
<FieldID>188744096</FieldID>
<Value>value</Value>
</ExtendedAttribute>
..
</Task>
</Tasks>
</Project>

When exporting from MS Project 2003 or 2007 the resulting file looks instead something like this:

<Project xmlns="http://schemas.microsoft.com/project">
..
<OutlineCodes>
<OutlineCode>
<FieldID>188744096</FieldID>
<FieldName>Outline Code1</FieldName>
<Values>
<Value>
<ValueID>1</ValueID>
<ParentValueID>0</ParentValueID>
<Value>value</Value>
</Value>
..
</Values>
..
</OutlineCode>
</OutlineCodes>
..
<ExtendedAttributes>
<ExtendedAttribute>
<FieldID>188744096</FieldID>
<FieldName>Outline Code1</FieldName>
</ExtendedAttribute>
</ExtendedAttributes>
..
<Tasks>
<Task>
..
<OutlineCode>
<UID>1</UID>
<FieldID>188744096</FieldID>
<ValueID>1</ValueID>
</OutlineCode>
..
</Task>
</Tasks>
</Project>

Maybe i missed something, but anyway this would be a real killer feature for us ;-)

Related

Bugs: #205
Feature Requests: #2

Discussion

  • Jon Iles

    Jon Iles - 2012-03-29
    • assigned_to: nobody --> joniles
     
  • Jon Iles

    Jon Iles - 2012-03-29

    No problem, I'll look at this once I've completed the current set of changes I'm working on in MPXJ.

    Jon

     
  • Lord Helmchen

    Lord Helmchen - 2013-12-02

    My work day was spent fixing this. Attached is a patch.
    The following code is how I make sure that the TaskFieldValueList for the outline codes is properly set. Just make sure you set your outline codes on all tasks before this.
    It might be worth to include into MPXJ aswell.

            //collect all outline code values
            int base = 0;
            for (int i = 0; i < ExtendedAttributeTaskFields.FIELD_ARRAY.length; i++)
            {
                if (ExtendedAttributeTaskFields.FIELD_ARRAY[i] == TaskField.OUTLINE_CODE1)
                {
                    base = i;
                    break;
                }
            }
            for(int i=0; i<= 9; i++)
            {
                String outlineCode = t.getOutlineCode(i+1);
                if(outlineCode == null)
                    continue;
                //Project does not like spaces...
                outlineCode = outlineCode.trim();
                TaskField key = ExtendedAttributeTaskFields.FIELD_ARRAY[base + i]; //OUTLINE_CODE1, ..., OUTLINE_CODE10
                List<Object> list = pFile.getTaskFieldValueList(key);
                if(list == null)
                    list = new ArrayList<Object>();
                if(list.contains(outlineCode))
                    continue;
                list.add(outlineCode);
                pFile.setTaskFieldValueList(key, list);
            }
    
     
  • Lord Helmchen

    Lord Helmchen - 2015-03-31

    Is there a problem with that patch?

     
  • Dave McKay

    Dave McKay - 2016-09-09

    Hi Jon. Can't comment on the viability of Lord H's patch, but I'm +1'ing the original request!

     

Log in to post a comment.

Monday.com Logo