Actual Properties
Contents
[
Hide
Show
]The actual properties are used to find out how much time or money has been sent on a task to date.
Working with Actual Properties
The static class Tsk exposes a number of properties for determining a task’s actual properties:
- ActualCost: a task’s actual cost (double).
- ActualOvertimeCost: a task’s actual overtime cost (double).
- ActualOvertimeWork: the actual overtime worked on a task (TimeSpan).
- ActualDuration: a task’s actual duration (TimeSpan).
- ActualStart: the date and time that a task actually started (DateTime).
- ActualFinish: the date and time that a task actually finished (DateTime).
- ACWP: the actual cost of the work performed on a task (double).
The ChildTasksCollector class collects all the child tasks from a given RootTask when used by TaskUtils.
Actual Properties in Microsoft Project
To access these properties in Microsoft Project:
- On the View menu, select More Views and then Task Entry.
- On the Insert menu, select Column and add the desired columns to the Task Entry form.
Getting Actual Properties with Aspose.Tasks
A tasks’ actual properties can be obtained by traversing the tasks in a project. The code samples below write the actual properties for all tasks found in a project to a console window.
1// Create Project instance
2Project project = new Project("New Project.mpp");
3
4// Create a ChildTasksCollector instance
5ChildTasksCollector collector = new ChildTasksCollector();
6
7// Collect all the tasks from RootTask using TaskUtils
8TaskUtils.Apply(project.RootTask, collector, 0);
9
10// Parse through all the collected tasks
11foreach (Task task in collector.Tasks)
12{
13 Console.WriteLine("Task Name : " + task.Get(Tsk.Name));
14 Console.WriteLine("Actual Start: " + task.Get(Tsk.ActualStart).ToLongDateString());
15 Console.WriteLine("Actual Finish: " + task.Get(Tsk.ActualFinish).ToLongDateString());
16 Console.WriteLine("Actual Duration: " + task.Get(Tsk.ActualDuration).TimeSpan.Hours.ToString());
17 Console.WriteLine("Actual Cost: " + task.Get(Tsk.ActualCost).ToString());
18 Console.WriteLine("---------------------------------------------");
19}