It's all about the answers!

Ask a question

calculated value of 3 enum values in RTC work item

almsupport alm (1319) | asked Jan 07 '20, 4:11 a.m.
edited Jan 07 '20, 4:58 a.m. by Ralph Schoon (63.3k33646)

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.


3 answers

permanent link
almsupport alm (1319) | answered Jan 13 '20, 4:33 a.m.


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.

 (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";

Thanks !! 

permanent link
Kevin Ramer (4.5k9185201) | answered Jan 07 '20, 4:36 p.m.
edited Jan 07 '20, 4:37 p.m.
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"/>

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.

permanent link
Matt Muller (59813674) | answered Jan 07 '20, 12:06 p.m.
edited Jan 07 '20, 12:07 p.m.

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

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.