calculated value of 3 enum values in RTC work item
We want to have calculate(multiply of 3 valiues) value for 3 different enumerated attributes. I came to know that it should be javascript. please let me know how the javascriptshould be. how it should be tested .
We created enum attribute serverity like 1 to 10 , second one is Occurance enum attribute 1 to 10 values and also Detection enum attribute 1 to 10 and also we have RPN Integer attribute in this we want multiplication of above 3 enum values and store it in RPN attribute.
Please support.
Regards,
ALM
3 answers
Hi ALM,
Firstly you need to ensure that CCM / RTC Scripts are enabled. (ref question answered before)
Then take a look at this example for calculated fields in work item to see if you can TEST a calculated script in a Dev environment.
1. I would test it's use in Web and Eclipse and then look in the Error logging (eclipse) to ensure you script is good.
2. Check the RTC logs to ensure nothing is output or any errors - not essential.
I hope that helps
Matt Muller
Related: Enumerations have 2 'parts' in the process config. One is the ID which is stored in the RTC database, the 2nd is the display value. One specific enumeration predefined for Scrum ( complexity ) has ID equal to the display value. You will want to verify that the fetch of the attribute value represents a numeric value.
Here's that complexity enumeration from a pretty basic Scrum configured project.
<enumeration attributeTypeId="complexity" name="complexity">
<literal default="true" id="0" name="0 pts"/>
<literal id="1" name="1 pt"/>
<literal id="2" name="2 pts"/>
<literal id="3" name="3 pts"/>
<literal id="5" name="5 pts"/>
<literal id="8" name="8 pts"/>
<literal id="13" name="13 pts"/>
<literal id="20" name="20 pts"/>
<literal id="40" name="40 pts"/>
<literal id="100" name="100 pts"/>
</enumeration>
If one adds a new value to this enumeration its 'id' will be something like complexity.literal.l7 and it will throw off some of RTC's calculations. I'm sure that the same feature will impact what OP is intending.
HI,
We tried for two enum attribute values multiplication but this code is not working for us.
Please review the code and suggest the right code.
dojo.provide("com.example.rpnrate");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.example.rpnrate", null, {
getLabel: function(attribute, workItem, configuration) {
try {
var Detection = parseString(workItem.getLabel("detection"));
var Probability = parseString(workItem.getLabel("Probability_Occurrence"));
var detect;
detect = Detection * Probability
return rpn.toString();
}
catch(err) {
var txt;
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.message + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
});
})();
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.example.rpnrate", null, {
getLabel: function(attribute, workItem, configuration) {
try {
var Detection = parseString(workItem.getLabel("detection"));
var Probability = parseString(workItem.getLabel("Probability_Occurrence"));
var detect;
detect = Detection * Probability
return rpn.toString();
}
catch(err) {
var txt;
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.message + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
});
})();
Thanks !!