Skip to main content

WorkComplete setting does not work for Parent activities


Technote (FAQ)


Question

How to force the parent activity's WorkComplete property automatically updated when changes occur in its child activities?

Cause

Calculating the WorkComplete value of a parent activity is highly dependent on the application requirements.

For instance, you can decide that it should be the minimum of all the child's WorkComplete value. But in an other situation, you can decide that it should be the average value of the child WorkComplete, or even if some child tasks are more important than others, some ponderated values.
With that in mind, the WorkComplete behavior has not been implemented for the parent activities, which by default will remain at 0 regardless of children activities WorkComplete.


Answer

To change this default behavior and automatically calculate the parent activity's WorkComplete each time one child WorkComplete is updated, you can listen to ActivitiesChanged events.

The code below demonstrates how to set the parent activity's WorkComplete value to the minimum value of all its child's WorkComplete :

this.simpleGanttModel1.ActivitiesChanged += new
ActivitiesChangeEventHandler(this.simpleGanttModel1_ActivitiesChanged);

private void simpleGanttModel1_ActivitiesChanged(object sender,
ILOG.Views.Gantt.Data.ActivitiesChangeEventArgs e)
{
if(e.Action.Equals(ActivitiesAction.PropertyChange))
{
if(e.Property.Equals("WorkComplete"))
{
if(!(e.Activity.Parent.Equals(null)))
{
float minWorkComplete=100;
IActivity parent = e.Activity.Parent;
IEnumerator enu = parent.ChildActivities.GetEnumerator();
while(enu.MoveNext())
{
if(((IActivity)enu.Current).WorkComplete <= minWorkComplete)
minWorkComplete = ((IActivity)enu.Current).WorkComplete;
}
parent.WorkComplete=minWorkComplete ;
}
}
}
}

Note:

The above code will work fine with activities such as SimpleActivity.

If you are using SchedulingActivity and ProjectSchedulingModel, the WorkComplete value for the parent activity is set to 0, and cannot be modified.


Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

IBM ILOG Gantt for .NET

General


Software version:
3.5, 4.0


Operating system(s):
Windows


Reference #:
1587076


Modified date:
2012-07-17

Translate my page

Content navigation