The CreatorCon Call for Content is officially open! Get started here.

Calculate field value based on other 2 field values for variance value in PPM

maneesh3
Tera Contributor

Hi Team,

How to set a field value after calculation based on other 2 fields : for effort variance in PPM

 

2 fields: Actual Effort  &  Planned Effort - 

in the Effort variance field I need to display after calculation of 2 fields like below formula:

Effort variance = Actual effort - Planned effort/Planned effort *100

 

Kindly Suggest how to achieve this

 

Thanks,

 

 

3 REPLIES 3

Joe S1
Kilo Sage

Hello Maneesh,

 

You're going to need to create 2 OnChange client scripts, 1 that will trigger OnChange of the Actual Effort field and 1 that will trigger OnChange of the Planned Effort field. Each script you're going to need to get the value of the other field (i.e. Actual Effort script you need to grab value of Planned Effort) and perform the calculation. You can then take the answer of the calculation and set the value of the Effort Variance field.

 

This way if the value changes in either field the variance value will be calculated and correct.

maneesh3
Tera Contributor

Hi Joe,

 

Thanks a lot for the response and greatly appreciate if you can provide me code samples , it will really help me

 

Thanks,

Sure,

 

This is just a sample, but something like this should work.

 

var act_effort = g_form.getValue('actual_effort');
var plan_effort = g_form.getValue('planned_effort');
var effort_var = '';

//make sure both fields have values
if (act_effort && plan_effort){
     effort_var = act_effort - plan_effort/plan_effort*100;
}

g_form.setValue('u_effort_variance', effort_var);

 

 You'll need two identical scripts like this, both OnChange one on actual effort and one on planned effort.