Search code examples
mpxjmpp

Issue with MPXJ 12.5.0: Extracting or Calculating Duration of a Split Task


Issue with MPXJ 12.5.0: Extracting or Calculating Duration of a Split Task

I am currently working with MPXJ version 12.5.0 and facing difficulty in finding the appropriate API to extract or calculate the duration of a split task projecting to a specific status date.

My initial approach was to extract the start and finish times of the splits and then perform manual calculations. However, I'm unable to locate the relevant API to obtain this information.

I may not be using the correct names for the objects, but I'm specifically referring to tasks where the Gantt bar is divided in several non-linears bars

My ultimate goal is to calculate the actual duration of the task on a given date. Due to the task being split, I'm struggling to obtain detailed split information to accomplish this. Any guidance or assistance in finding the appropriate API or alternative methods would be greatly appreciated.

I've tried using the getSplits() method, but it do not return what i expecting. Also tried to search in the Gantt Views api's but coudn't find some way to view this information about the splitted tasks


Solution

  • I've talked with one of the maintainers of the library and the getSplits was not working as expected, he mentioned that would be corrected in the next release. Here is the related issue

    I ended up going into another approach to solve the problem, with the win32 library, working directly with the MsProject.

    Here below is my solution to extract data from mpp files while resheduling some tasks:

    msproject = Dispatch("MSProject.Application")
    msproject.FileOpen(file_path)
    
    # Here the tasks are resheduled to 
    msproject.UpdateProject(All=True, UpdateDate=date, action=1)
    project = msproject.ActiveProject
    # then it's just get the tasks
    tasks = project.Tasks
    

    It's required to have MSProject installed, hope it can help