Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes



3 answers

Permanent link
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

0 votes


Permanent link
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.

0 votes


Permanent link

  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); 
        }
 
    }
 
    });
})();

Thanks !! 

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Jan 07 '20, 4:11 a.m.

Question was seen: 2,411 times

Last updated: Jan 13 '20, 4:33 a.m.

Confirmation Cancel Confirm