Menu

#325 getChildTasks( ) API is returning '1' for leaf level tasks.

v1.0_(example)
closed-invalid
Jon Iles
MPXJ (1)
5
2018-04-12
2018-04-11
No

Hello,

We are facing an issue while reading data using mpxj. On debugging, we observed that the API "getChildTasks( )" was returning 1 for some tasks/activities which are present at the leaf level.
Could you please help me resolve this issue or provide me with any leads as to why the API is returning incorrect value? We are using the latest version of MPXJ (7.2)
Please find the attached mpp file.

Best Regards,
Nimish.

1 Attachments

Discussion

  • Jon Iles

    Jon Iles - 2018-04-11

    What langauge are you working in? Can you post some sample code? (just a few lines will do).

     
  • Nimish Morey

    Nimish Morey - 2018-04-11

    Hi Jon,
    Thanks for reverting. So we are using JAVA (8). Below is the snippet of code used:

    public void checkTasks (ProjectFile mpxjFile, ErrorReport er) throws WTException, MPXJException {        
            List<Task> tasks = mpxjFile.getAllTasks();
            Iterator<Task> it = tasks.iterator();
            while (it.hasNext()) {
                Task task = it.next();
                if (task.getChildTasks().size() > 0) {
                    List<net.sf.mpxj.ResourceAssignment> assignments = task.getResourceAssignments();
                    if (assignments.size() > 0) {
                        Object[] params = {task.getName()};
                        String name = (WTMessage.getLocalizedMessage(RESOURCE, msprojectResource.OBJECT_TYPE_TASK, params, locale));
                        String desc = (WTMessage.getLocalizedMessage(RESOURCE, msprojectResource.SUMMARY_RESOURCE_ASSIGNMENTS_NOT_SUPPORTED, null, locale));
    
                        Error e = createNewError(task.getID().toString(), name, desc, true);
                        er.getErrors().add(e);
                    }
                }
            }
     }
    

    Kindly revert for any concerns.
    Best Regards,
    Nimish.

     
  • Jon Iles

    Jon Iles - 2018-04-12

    Hi,

    I've been unable to reproduce. I ran the sample file you provided through MPXJ here and printed out the child task count for all tasks. The output is shown below. Can you let me know which leaf tasks you were getting incorrect results for?

    Jon

    Name Child Count
    Project-PLM (AP)_New 1
    Project-PLM (AP) 6
    C0. Proposal Phase 3
    C0.1 0
    C0.2 0
    C0.3 0
    C1. Planning Phase 3
    C1.1 0
    C1.2 0
    C1.3 0
    C2. Design Phase 5
    Hardware Development 5
    C2.1.1 0
    C2.1.2 0
    C2.1.3 0
    C2.1.4 0
    C2.1.5 0
    Software Development 3
    C2.2.1 0
    C2.2.2 0
    C2.2.3 0
    Testing Development 3
    C2.3.1 0
    C2.3.2 0
    C2.3.3 0
    Mechanical Development 3
    Case 9
    C2.4.1 0
    C2.4.2 0
    C2.4.3 0
    C2.4.4 0
    C2.4.5 0
    C2.4.6 0
    C2.4.7 0
    C2.4.8 0
    C2.4.9 0
    C2.5.1 0
    C2.5.2 0
    C2.6 0
    C3 Sample Run 2
    C3.1 Sample Run? 6
    Hardware Development 5
    C3.1.1 0
    C3.1.2 0
    C3.1.3 0
    C3.1.4 0
    C3.1.5 0
    Software Development 3
    C3.2.1 0
    C3.2.2 0
    C3.2.3 0
    Mechanical Development 4
    C3.3.1 0
    C3.3.2 0
    C3.3.3 0
    C3.3.4 0
    Manufacturing Product 5
    C3.4.1 0
    C3.4.2 0
    C3.4.3 0
    C3.4.4 0
    C3.4.5 0
    Testing Development 6
    C3.5.1 0
    C3.5.2 0
    C3.5.3 0
    C3.5.4 0
    C3.5.5 0
    C3.5.6 0
    Customer verification 3
    C3.6.1 0
    C3.6.2 0
    C3.6.3 0
    C3.2 Sample Run? 6
    Hardware Development 4
    C3.2.1.1 0
    C3.2.1.2 0
    C3.2.1.3 0
    C3.2.1.4 0
    Software Development 2
    C3.2.2.1 0
    C3.2.2.2 0
    Mechanical Development 4
    C3.2.3.1 0
    C3.2.3.2 0
    C3.2.3.3 0
    C3.2.3.4 0
    Manufacturing Product 5
    C3.2.4.1 0
    C3.2.4.2 0
    C3.2.4.3 0
    C3.2.4.4 0
    C3.2.4.5 0
    Testing Development 6
    C3.2.5.1 0
    C3.2.5.2 0
    C3.2.5.3 0
    C3.2.5.4 0
    C3.2.5.5 0
    C3.2.5.6 0
    Customer verification 3
    C3.2.6.1 0
    C3.2.6.2 0
    C3.2.6.3 0
    C4. Pilot Run Phase 5
    Hardware Development 4
    C4.1.1 0
    C4.1.2 0
    C4.1.3 0
    C4.1.4 0
    Software Development 2
    C4.2.1 0
    C4.2.2 0
    Testing Development 6
    C4.3.1 0
    C4.3.2 0
    C4.3.3 0
    C4.3.4 0
    C4.3.5 0
    C4.3.6 0
    Mechanical Development 2
    C4.4.1 0
    C4.4.2 0
    Manufacturing Product 4
    C4.5.1 0
    C4.5.2 0
    C4.5.3 0
    C4.5.4 0
    C5. Mass Production 3
    C5.1 0
    C5.2 0
    C5.3 0
     
  • Nimish Morey

    Nimish Morey - 2018-04-12

    Hi Jon,

    Thanks for the update.
    Just a correction, I had tested this on latest MPXJ version(7.2), there this issue seems to be fixed.
    Actually, we recently upgraded from 5.13 to 7.2. Based on this observation it appears that the issue is fixed somewhere between 5.13 to 7.2.
    Would you please check if you are able to reproduce this issue on MPXJ (5.13) and if you are able to, could you please point me to the version where this issue was addressed?

    Best Regards,
    Nimish.

     
  • Jon Iles

    Jon Iles - 2018-04-12

    Apologies, unfortunately I won't have time to go through the 17 releases of MPXJ to identify where the fix was applied. Looking at the release notes (http://www.mpxj.org/changes-report.html) it may be that 5.14.0 had the relevant fix as it mentions correcting the task hierarchy.

     
  • Jon Iles

    Jon Iles - 2018-04-12
    • status: open --> closed-invalid
    • assigned_to: Jon Iles
     

Log in to post a comment.

MongoDB Logo MongoDB