It's all about the answers!

Ask a question

Issue with script based calculated value in RTC 3.0.1.3.


Anatoliy Khludov (32613) | asked Nov 29 '12, 3:11 p.m.

I have created three new attributes of type "Duration" --  "QA Estimate", "Dev Estimate" and "Total Estimate". The "Total Estimate" attribute uses calculated value from the script TimeEstCalc.js and has dependencies on "QA Estimate" and "Dev Estimate" attributes.

Here is the TimeEstCalc.js script:

dojo.provide("com.example.common.TimeEstCalc");

 

(function() {

    dojo.declare("com.example.common.TimeEstCalc", null, {

 

        getValue: function(attribute, workItem, configuration) {

 

                                             return workItem.getValue("devEstimate") + workItem.getValue("qaEstimate");

 

        }

    });

})();

After I enter values into "QA Estimate" and "Dev Estimate" fields in the newly created work item, and trying to save the work item, I get the error:

The value of attribute 'Total Estimate' is not valid. Enter a valid duration (w = weeks, d = days, h = hours, m = minutes).

So looks like the "Total Estimate" attribute expects values to be entered instead of returning the calculated value based on the script.

I have script execution enabled in teamserver.properties.

Not sure what I am doing wrong.

Anatoliy

2 answers



permanent link
Anatoliy Khludov (32613) | answered Nov 30 '12, 12:13 p.m.
Hi Lauren, thank you -- I will look into that. Looks like I created a double post -- I received another answer from Brian Fleming. Is there a way to remove one of the posts ?

Comments
Lauren Hayward Schaefer commented Nov 30 '12, 12:43 p.m.
JAZZ DEVELOPER

Hi Anatoliy,
You should be able to close one of your questions by clicking the "close" option above your name in your original question.


permanent link
Lauren Hayward Schaefer (3.3k11727) | answered Nov 30 '12, 7:11 a.m.
JAZZ DEVELOPER
edited Nov 30 '12, 7:11 a.m.
Hi Anatoliy,

I found this article that has a section on calculated values:  https://jazz.net/library/article/1003/#calc-values .  In their example, their return statement includes strings representing days, hours, and minutes:
return days +" d, "+  hours +" hr, "+ minutes  +" min";
I'm wondering if adding those strings to your return statement would fix your problem.

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.