How to traverse the estimate object hierarchy

The root estimate object is represented by the IEstimate interface.

Once you have the IEstimate object, you can access all other data via its properties and methods. The object hierarchy follows the structure of an estimate that you can see in QDV. An estimate contains one or more versions. Each version contains WBS, which in turn contains tasks and minutes.

For example, you can get the IEstimateVersion object (which represents a single estimate version/progress) via IEstimate.CurrentVersion property. Then you can access the WBS via IEstimateVersion.Wbs property and so on.

The following class diagram illustrates a possible scenario.

Let's say we want to retrieve the value of Description field on the first line in the A1 minute. The WBS has the following structure:

<ROOT> 
  A 
    A1 
    A2 
  B 
    B1

The arrows in the diagram show the code path.

  1. We start with an IEstimate object. It may contain multiple versions but we are interested only in the current one. So we use IEstimate.CurrentVersion property (represented by an arrow) to get an IEstimateVersion instance.
  2. In the next step we get the WBS as an IWbs object via IEstimateVersion.Wbs property.
  3. The WBS contains a tree hierarchy of tasks. Each leaf task contains a minute. The tree structure is represented by a root task and then each task has the ITask.SubTasks property. We use SubTasks property twice to get the A1 task.
  4. Once we have the proper task, we can use the ITask.Minute property to get the IMinute instance.
  5. Finally, we get the field value with the IMinute.GetFieldValue method.

Here's the complete code:

Dim wbs As IWbs = Es.CurrentVersion.Wbs
 Dim taskWithMinute As ITask = wbs.Root.SubTasks(0).SubTasks(0)
 Dim minute As IMinute = taskWithMinute.Minute
 Dim val As Object = minute.GetFieldValue(1, "Description")
 ' or as a single line:
 val = Es.CurrentVersion.Wbs.Root.SubTasks(0).SubTasks(0).Minute.GetFieldValue(1, "Description")					
This language is not supported or no code example is available.
IWbs wbs = Es.CurrentVersion.Wbs;
 ITask taskWithMinute = wbs.Root.SubTasks(0).SubTasks(0);
 IMinute minute = taskWithMinute.Minute;
 object val = minute.GetFieldValue(1, "Description");
 // or as a single line:
 val = Es.CurrentVersion.Wbs.Root.SubTasks(0).SubTasks(0).Minute.GetFieldValue(1, "Description");					
This language is not supported or no code example is available.

In this article

Definition