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 Task 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.
- ActualDuration: a task’s actual duration (TimeSpan).
- ActualStart: the date and time that a task actually started (Date).
- ActualFinish: the date and time that a task actually finished (Date).
- 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.
Actual properties in a Microsoft Project file
Getting Actual Properties with Aspose.Tasks
A tasks actual properties can be obtained by traversing the tasks in a project. The code samples below writes the actual properties for all tasks found in a project to a console window.
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(ActualProperties.class);
4
5Project project = new Project(dataDir + "E - 1 Task.mpp");
6
7// Create a ChildTasksCollector instance
8ChildTasksCollector collector = new ChildTasksCollector();
9
10// Collect all the tasks from RootTask using TaskUtils
11TaskUtils.apply(project.getRootTask(), collector, 0);
12
13// Parse through all the collected tasks
14for (Task task : collector.getTasks()) {
15 System.out.println("Task Name : " + task.get(Tsk.NAME));
16 System.out.println("Actual Start: " + task.get(Tsk.ACTUAL_START).toString());
17 System.out.println("Actual Finish: " + task.get(Tsk.ACTUAL_FINISH).toString());
18 System.out.println("Actual Duration: " + task.get(Tsk.ACTUAL_DURATION).toString());
19 System.out.println("Actual Cost: " + task.get(Tsk.ACTUAL_COST).toString());
20 System.out.println("---------------------------------------------");
21}