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

Calculating the time duration spent by a work item in a particluar state in javascript

hi ,

I want to calculate the RTC time spent by workitem in a particular state ,but I am not using  any reporting framework, I have to do it using the query and javascript. Please advise on the same

0 votes



One answer

Permanent link
I am not sure this is possible today. At least, it is not easy. You can not detect a state change easily with Java Script. We did a workshop around JavaScript: https://jazz.net/library/article/1093 Lab 5.

getWorkFlowAction() also does not tell you that the state is changing. The problem is not detecting the state, it is detecting the change. I think you would have to use an attribute to calculate the current state and store it there. And then use another calculation to detect the state has changes and store the time in another attribute.

The method below won't work as it only works in conditions and it does only indicate that the state might change, but not that it actually changed.

Since 4.0:
since 4.0 M1 getWorkflowAction() returns a string that is the id of a workflow action currently selected by the user. This action will be executed when the item is saved. If the user has not selected any action this method will return null . Note: This method works only when used inside a Condition script, the return value will always be null when this is used in other customization script types.

You have way better handling on this in a participant. E.g. see http://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/

If you want to explore that route, start here: http://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/

You also would likely need an attribute for every state you want to track.

If others solved this problem, I would be happy to hear about it.

0 votes

Comments

I have a similar request to this.  The scenario is this.  A work item is moved to an active state say, working. When the work item is saved then a timestamp is saved into an attribute starttime.  When the work item is moved to a non-active state say, delayed or completed.  Again a timestamp is saved into an endtime attribute.  From this data we can calculate a "duration of active time" and then store that in another attribute total time.

I thought that follow-up actions are not allowed to modify attributes?  Since the user would have to click the save button to transition the Work Item from active to non-active and the reverse.  How can we get this information?  Seems like a catch 22?  My other thought was like mentioned above, use Calculated Values Scripts or Conditions Scripts?  But like you stated above the user may not change the state of the work item, just save the work item.

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

Question asked: May 08 '14, 4:28 a.m.

Question was seen: 4,186 times

Last updated: Jul 23 '14, 9:39 a.m.

Confirmation Cancel Confirm