Search code examples
c#mpxjprimavera

MPXJ C# - Resource assignment count


I have a XER file that I imported to my trial version of Primavera P6. Here is an screen shot of one of the activity's assigned resources: enter image description here As you see I have 14 resources in Primavera but when I watch it in Visual Studio I have 13 resources: enter image description here Well I guess it has problem with duplicate assignment of same resource(I marked in the first screen shot).

Am I right? Is there any way to get all 14 resources on C# side?


Solution

  • This is indeed your problem. The source code for Task.addResourceAssignment, which is responsible for adding resource assignments to the model, will not add multiple assignments to the same resource. Only the first such assignment will be added. Subsequent assignments will be ignored.

    It would be possible to modify MPXJ to do what you want but it might be complex. Probably, there are many parts of MPXJ that fundamentally assume this is not allowed. I'm not an MPXJ expert, I just read enough of the source code to answer your question.