OutlineValue.ParentValueId

Using Aspose.Tasks 6.8.0.0


I have a simple hierarchical outline code in Project, of the form
1
1.1
1.2
1.3
2
3

When I look at it in my .NET code, through Aspose.Tasks I would expect the ParentValueId of the three children nodes (1.1, 1.2, 1.3) to be equivalent to the ValueId of their parent (1) but that is not the case.

Using a simple loop to output the values:
Debug.WriteLine(“ValueId - Value - Description - ParentValueId”);
foreach(OutlineValue ov in Project.OutlineCodes.Last().Values) {
Debug.WriteLine(ov.ValueId.ToString() + " - " + ov.Value + " - " + ov.Description + " - " + ov.ParentValueId.ToString());
}

I get the following:
ValueId - Value - Description - ParentValueId
17 - 1 - one - 1
25 - 1 - oneone - 1114114
26 - 2 - onetwo - 1114114
27 - 3 - onethree - 1114114
18 - 2 - two - 1
19 - 3 - three - 1

Why is the ParentValueId of the three children 1114114? Shouldn’t it me 17?

I am trying to walk the structure in my code to bring in into my system as a hierarchy, but can’t really do it if the parent ids are screwed up.


Hi Jim,


Thank you for posting your inquiry.

You are referring to wrong field for retrieving the required information. You actually need to retrieve the Outline Numbers information but are retrieving Outline codes. Please have a look at the following code sample for retrieving this information for a task.

Code:

Project project = new Project(“OutlineNumbers.mpp”);

Task task1 = project.RootTask.Children.GetById(1);
TaskCollection childTasks = task1.Children;
foreach (Task task in childTasks)
{
Console.WriteLine(task.Get(Tsk.Name));
Console.WriteLine(task.Get(Tsk.OutlineNumber));
Console.WriteLine(task.Get(Tsk.OutlineLevel));
}

I think you are misunderstanding my question. You are talking about the Outline Numbers that deal with the hierarchy of the TASKS in a schedule.


That is not what I want. I have a schedule that has a hierarchical code field. It is in Outline Code5. I want to retrieve the values for that code field, including its structure so that I can recreate in my product. (Picture attached of what I am talking about.)

My code successfully gets the Outline Code and I see all the values. The only thing wrong seems to be the parent id. I don’t understand why the ParentValueId of the three children is 1114114.


Hi Jim,

Following sample code displays the Outline codes’ ValueId, Value, Description and ParentValueID in a project. Aspose.Tasks for .NET 8.8.1 is used for this testing. Please give it a try and let us know the feedback.

Project proj = new Project("Outlinecode.xml");
OutlineCodeDefinition def = proj.OutlineCodes.Last();
foreach (OutlineValue ov in def.Values)
{
    Console.WriteLine(ov.ValueId.ToString() + " - " + ov.Value + " - " + ov.Description + " - " + ov.ParentValueId.ToString());
}

Ok. I saved my project in the XML format and then tried the code and yes the values are correct.


ValueId - Value - Description - ParentValueId
17 - 1 - one - 0
25 - 1 - oneone - 17
26 - 2 - onetwo - 17
27 - 3 - onethree - 17
18 - 2 - two - 0
19 - 3 - three - 0

So the issue seems to be that when using an MPP file the ParentValueId values are incorrect in Aspose.Tasks. Agreed?


Hi Jim,


I have logged the issue of incorrect ParentValueId values in MPP in our issue tracking system under Id: TASKS-34245 for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.


Thanks Muhammad!

While we await feedback on that issue I had another question…


Is there a method or property in the API that will give me the full name/path of an OutlineValue?

That is “1.1” for example.

I don’t see one. The only way I see to do it is to actually use the ParentValueID along with the the OutlineCodeDefinition.Masks to build it myself. But of course that won’t work until the ParentValueID issue is resolved. I was hoping there was already a way to get the full name/path for an OutlineValue.

Hi Jim,


I am sorry to share that I could not find any such method to retrieve this information as an alternate way to achieve the same. We shall update you here once we have information about the issue logged for this problem.

The issues you have found earlier (filed as TASKS-34245) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thanks! I just downloaded and will start hacking away at it to verify the fix on my setup.

Hi Jim,


Please let us know if you face some issue while testing with the new version. We shall look into it further for assisting you.

In order to use the new fix we are jumping from 6.8.0 to 8.9.0. Below are some adjustments/questions/clarifications:


ProjectReader
Gone, so now I just use the Project construct with a file stream, correct?

Calculations
Our code used to call the following after adding new tasks:
Project.UpdateReferences();
Project.CalcTaskIds();
Project.CalcTaskUids();

But now I don’t see those on the Project object. What should I call instead of those in the current version?

Project (What are these now?)
Project.GetResourceAssignmentsByTask
Project.RemoveResourceAssignment
Project.RemoveLink
Project.RemoveTask

Task (What are these now?)
Task.Children.Clear()

Calendar (What are these now?)
Calendar.Days
Calendar.WorkWeeks

Thanks. I am

Hi Jim,

You can find the migration changes mentioned in our article, Migration to Aspose.Tasks for .NET 8.0.0 and higher. Following are the equivalents of your above requirements. Please have a look at these and let us know if we can be of additional help to you.

1. Yes, the ProjectReader calss is no more available and you can use the Project class constructor as you have mentioned.

2. There is only one Project.Recalculate method and all other calculations are carried on automatically.

Code Sample:

Task tsk = project.RootTask.Children.GetById(0);

//Project.GetResourceAssignmentsByTask
ResourceAssignment ra = tsk.Assignments.GetByUid(1);

//Project.RemoveResourceAssignment
ra.Delete();

//Project.RemoveLink
project.TaskLinks.Remove(sometaskLink);

//Project.RemoveTask
tsk.Delete();

//Task.Children.Clear() - No equivalent. Deleting a parent task deletes the children tasks

//Calendar.Days =>
Calendar.WeekDays;

//Calendar.WorkWeeks - This is no more supported in the revamped API

So does that mean there is no way to get the Work Week information for a calendar at all anymore? Any plans to add it back in? I mean Project still allows them to be defined so that seems odd to not give access to that information.

Hi Jim,


Thank you for writing to Aspose support again.

I have logged the requirement of reading Work Weeks from Calendar as Enhancement ticket under Id: TASKS-34382 in our issue tracking system for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.

Thanks.


First the good news. I’ve gotten past all the code change to update my code to use 8.9.0.

Now the bad news. I still see the original ParentValueId issue that I reported. Attached is the mpp I am using.

And I still see the issues:

1. The level 1 nodes have ParentValueId = 1 when they should be 0
2. The level 2 nodes have ParentValueId = 65538

I attached Capture.PNG to display the issue.

Hi Jim,


Thank you for writing to Aspose support again.

I have re-produced the issue here and logged it under Id: TASKS-34383 in our issue tracking system for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.

The issues you have found earlier (filed as TASKS-34383;TASKS-34382) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thank you! Just finally had time to get back to this and both my issues seem to be fixed and working. Thanks again!