Handling Variances
Contents
[
Hide
Show
]A work variance is the difference between the estimated work (the baseline) and actual work performed.
Handling Variances
The WorkVariance property exposed by the Resource class handles variance in work:
- WorkVariance: a project resource’s difference from the baseline work (double).
Microsoft Project View of Resource Work Variance
To see the resource work variance in Microsoft Project:
- On the Resource Sheet, go to the Insert menu and select Column.
- Add the Variance column.
Variance in Microsoft Project
Getting Resource Work Variance in Aspose.Tasks
The following examples show how to get resource work variance using Aspose.Tasks.
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(HandleVariances.class);
4
5Project project = new Project();
6Task task = project.getRootTask().getChildren().add("Task");
7java.util.Calendar cal = java.util.Calendar.getInstance();
8cal.set(2014, 2, 15, 8, 0, 0);
9project.set(Prj.START_DATE, cal.getTime());
10task.set(Tsk.DURATION, project.getDuration(2));
11
12project.setBaseline(BaselineType.Baseline);
13cal.set(2013, 11, 29, 8, 0, 0);
14task.set(Tsk.START, cal.getTime());
15cal.set(2013, 11, 27, 8, 0, 0);
16task.set(Tsk.STOP, cal.getTime());