We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

P6 XML import Task Status Problem

Hello,

I have a P6 XML file that has “Activity”, then under “Activity” is “STATUS”.

After importing into an ASPOSE project, I can’t find in the Tsk object where this “STATUS” value is. Please help!

Edit: When I export the Project, I can see “STATUS” under “Activity”, so it should be somewhere in the ASPOSE object. But where?

Thanks,

S

@seanm555

In order to investigate the issue further on my end, I request you to please share the sample code as well as source file along with snapshot that what information you are unable to access using API. We will investigate that further on our end to help you out.

I uploaded the P6 XML Export.

You can see the “Activity” field “STATUS” under each Tasks/Activities in the P6 XML file.

  1. Import the P6 XML into ASPOSE project using the third Project UID as it has all the data.
    Dim reader As PrimaveraXmlReader = New PrimaveraXmlReader(sFileName)
    Dim listOfProjectUids As List(Of Int32) = reader.GetProjectUids()
    If listOfProjectUids.Count > 1 Then
    m_P6ProjList = New List(Of Integer)

                        Dim options As PrimaveraXmlReadingOptions = New PrimaveraXmlReadingOptions()
                        For i As Integer = 0 To listOfProjectUids.Count - 1
    

options.ProjectUid = listOfProjectUids(i)
m_prjIOProject = New Project(sFileName, options)
Console.WriteLine("Root: " & m_prjIOProject.RootTask.Get(Tsk.Name))
If m_prjIOProject.Get(Prj.Name) IsNot Nothing Then
If m_prjIOProject.Get(Prj.Name).Length > 0 Then
If m_prjIOProject.RootTask.Get(Tsk.Name) IsNot Nothing Then
If m_prjIOProject.RootTask.Get(Tsk.Name).Length > 0 Then
m_P6ProjList.Add(listOfProjectUids(i))
End If
End If
End If
End If
Next
If m_P6ProjList.Count > 0 Then

                            options.ProjectUid = m_P6ProjList(0)
                            m_prjIOProject = New Project(sFileName, options)

end if

  1. After successful import, where in the Tsk object structure can I find “STATUS”?

look at m_prjIOProject.RootTask.Children(0).Children(0).Children(0), which should be a Task/Activity.

  1. m_prjIOProject.RootTask.Children(0).Children(0).Children(0).Get(Tsk.???) How to get “STATUS” that is in the P6 XML?

  2. Export the project to P6 XML. You will notice that all of the tasks have “STATUS” under “ACTIVITY”
    m_prjIOProject.Save(m_sIOProjectPath, Saving.SaveFileFormat.PrimaveraP6XML)
    Where did this “ACTIVITY/STATUS” value come? I can’t see it anywhere in the ASPOSE project object, but it must be there somewhere to be written out during the export.

Where can I get this field in the m_prjIOProject object structure?

GillelandCreekSubAdd-1024081_2021-04-14-07-45-44-503.zip (34.7 KB)

Thanks,

S

@seanm555

We need to investigate this further on our end and a ticket with ID TASKSNET-10326 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will fixed.

@seanm555

We have investigated the issue on our end. The content of “Status” tag is simply a text representation of tasks’s progress and is calculated based on task’s Tsk.PercentComplete field. It is not stored anywhere and generated only when exporting project to Primavera P6 format.

You can use the following snippet to get status:

public static string GetStatus(Task task)
{
    var percentComplete = task.Get(Tsk.PercentComplete);

    if (percentComplete <= 0)
    {
        return "Not Started";
    }

    return percentComplete  < 100 ? "In Progress" : "Completed";
}

Thanks for your response. This makes sense now.

@seanm555

It’s good to know that suggested solution has worked on your end.