Handling Critical and Effort-driven Tasks
Contents
[
Hide
Show
]Microsoft Project recognized a number of different types of tasks. Tasks with no duration, for example, are considered milestones by default. Critical tasks make up the critical path, one or a series of tasks that, ultimately, determines how long a project will take.
Working with Critical and Effort-Driven Tasks
The Tsk class exposes the IS_CRITICAL and IS_EFFORT_DRIVEN properties to handle critical and effort driven tasks.
Critical and Effort-driven Tasks Microsoft Project
To see whether a task is critical or effort-driven in Microsoft Project double-click a task in the Task Entry form.
An effort-driven task in Microsoft Project
Getting Critical and Effort-driven Tasks
The following code examples show how to get information about whether a task is critical or effort-driven.
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(CriticalAndEffortDrivenTasks.class);
4
5Project project = new Project(dataDir + "input.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 tsk : collector.getTasks()) {
15 String strED = tsk.get(Tsk.IS_EFFORT_DRIVEN) != null ? "EffortDriven" : "Non-EffortDriven";
16 String strCrit = tsk.get(Tsk.IS_CRITICAL) != null ? "Critical" : "Non-Critical";
17 System.out.println(strED);
18 System.out.println(strCrit);
19}