ResourceAssignment is not added when exporting to Primavera in MSPDI format
Multi platform library to read and write schedule data
Brought to you by:
joniles
I am facing a problem when exporting to mspdi
When I add a ResourceAssignment to a task using the following code:
Resource assignedResource = file.addResource();
assignedResource.Name = "Assigned Resource";
Task parent = file.addTask();
parent.Name = "Parent";
Task task = parent.addTask();
task.Name = "StackOverflow Example Task";
task.Start = CreateDate("2023-10-19T23:59:00");
task.Duration = Duration.getInstance(3, TimeUnit.DAYS);
task.Work = Duration.getInstance(15, TimeUnit.HOURS);
task.RemainingWork = Duration.getInstance(15, TimeUnit.HOURS);
double hoursPerDay = 8.0;
double hoursWorkedPerDay = 5.0;
ResourceAssignment resourceAssignment = task.addResourceAssignment(assignedResource);
resourceAssignment.Start = CreateDate("2023-10-19T23:59:00");
resourceAssignment.Work = Duration.getInstance(15, TimeUnit.HOURS);
resourceAssignment.RemainingWork = Duration.getInstance(15, TimeUnit.HOURS);
resourceAssignment.Units = NumberHelper.getDouble((hoursWorkedPerDay / hoursPerDay) * 100.0);
When I'm importing into Primavera I get the following error:
(I use: net.sf.mpxj-for-csharp: 13.4.0, MSPDIWriter to create the file)
Resource: Key: 1 missing required related object CurrencyNameId. Rejecting
Resource 'Resource: Key: 1' not imported
However, if you create a file in xer format, there is no error.
(I am attaching a file with import information)
Thanks in advance, let me know if you need more detailed information
Hello! I think you've opened the same issue over on GitHub, let's use that one and I'll close this one.