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

I want to use a Calculated field to sum an attribute from all children.

Hello Folks,

I'm using Agile in RTC and have Story(parent) and Tasks (children) so, I'm trying to create a new calculated field in Story to show the sum of all hours spent in the tasks (tasks are children of an Story - always).

My problem is that I can't to get the Tasks(children) associated in a Story(Parent)

I used this script to check if RTC will get the number of child right, but the result is always 0;

dojo.provide("org.example.workitems.providers.TotalHoursAssociated");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");

(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

dojo.declare("org.example.workitems.providers.TotalHoursAssociated", null, {

    getValue: function(attributeId, workItem, configuration) {
   
   var allTasks = configuration.getChildren();
  
   return allTasks.length;
    }
});
})();

What I'm doing wrong?

Someone could help me?

Thanks in advance.

0 votes



2 answers

Permanent link
The "configuration" element is part of the (process) customization configuration, and is "static" during runtime. See below sample in the API reference - pay attention to the way "greeting" is configured. Likewise, you will need such configuration in order to return anything for the call configuration.getChildren().
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_Example

Note that the "children" relationship in your mind is essential a "link" between work items, which in my knowledge is not supported.

Edit: someone asked a similar question in the past, and the answer was similar.
https://jazz.net/forum/questions/105450/how-to-get-parent-work-item-attribute-value-in-dojo-script-to-rtc-project-area

0 votes


Permanent link
As far as my experience goes you can't traverse links in the published JavaScript API that works in the Web UI and the Eclipse client. You can do something like that using Java. See https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/

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,938

Question asked: Apr 12 '16, 5:56 p.m.

Question was seen: 2,294 times

Last updated: Apr 13 '16, 2:03 a.m.

Confirmation Cancel Confirm