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

Calculated fields

We have a Defect work item, and we know when it has been raised and closed (or even resolved).
My customer would like to see a calculated field with the "total number of days between raised and closed".

a) Can I do this on the work item itself? If so, how?
b) Is there any future enhancement to have this kind of calculated columns within a query result?

I can see a workaround providing a Birt report, but my customer would like to see it handy in the work item instead of running a report.

Any ideas? Thanks in advance,
-- Claudia Callegari

0 votes



2 answers

Permanent link
We have a Defect work item, and we know when it has been raised and
closed (or even resolved).
My customer would like to see a calculated field with the "total
number of days between raised and closed".

a) Can I do this on the work item itself? If so, how?
b) Is there any future enhancement to have this kind of calculated
columns within a query result?

I can see a workaround providing a Birt report, but my customer would
like to see it handy in the work item instead of running a report.

A preliminary implementation of Calculated Attributes (the calculation
is done in JavaScript) is available in 2.0.0.2. We are working on
improved support for 3.0.

In the JS, you could take the resolution date and the creation date
(both built-in work item attributes) and return the difference. This
value provider would then be bound to a custom attribute like 'Days
Open' and show the number of days as a number. The attribute is then
also queryable, e.g. "Show me all major bugs that have been open more
than 30 days").

https://jazz.net/wiki/bin/view/Main/AttributeValueProviders

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
I followed the example on the Wiki.

Under <data>, I have:
<configuration-data xmlns="http://com.ibm.team.workitem/providers" id="com.ibm.team.workitem.configuration.providers">

<valueProviders>
<valueProvider id="exposure" providerId="com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider" name="Exposure Provider">
<script class="com.example.common.ExposureProvider"/>
<impactAttribute id="riskImpact"/>
<probabilityAttribute id="riskProbability"/>
</valueProvider>
</valueProviders>
</configuration-data>

under <configuration-data xmlns="http://com.ibm.team.workitem/workitemTypes" id="com.ibm.team.workitem.configuration.workItemTypes">, I have
<customAttributes category="com.ibm.team.workitem.workItemType">

<customAttribute id="riskProbability" name="Risk Probability" type="risk.probability"/>
<customAttribute id="riskImpact" name="Risk Impact" type="risk.impact"/>
<customAttribute id="riskExposure" name="Risk Exposure" type="long"/>
</customAttributes>

under <attributeDefinitions>, I have
<attributeDefinition id="riskExposure" name="Risk Exposure" readOnly="true" type="long">

<valueProvider providerId="exposure"/>
<dependsOn id="riskImpact"/>
<dependsOn id="riskProbability"/>
</attributeDefinition>

under the presentations section, I have:
<section id="com.ibm.team.workitem.section.details">

<presentation attributeId="riskImpact" kind="com.ibm.team.workitem.kind.enumeration"/>
<presentation attributeId="riskProbability" kind="com.ibm.team.workitem.kind.enumeration"/>
<presentation attributeId="riskExposure" kind="com.ibm.team.workitem.kind.long"/>
...

under the enumerations, I have:
<enumeration attributeTypeId="risk.probability">

<literal default="true" id="risk.probability.literal.unassigned.0" name="Not Assessed" null="true"/>
<literal id="risk.probability.literal.000" name="0% - Will Not Occur"/>
<literal id="risk.probability.literal.020" name="20% - Highly Unlikely"/>
<literal id="risk.probability.literal.040" name="40% - Unlikely"/>
<literal id="risk.probability.literal.060" name="60% - Probable"/>
<literal id="risk.probability.literal.080" name="80% - Highly Probable"/>
<literal id="risk.probability.literal.100" name="100% - Will Occur"/>
</enumeration>
<enumeration attributeTypeId="risk.impact">
<literal default="true" icon="processattachment:/enumeration/unassigned.gif" id="risk.impact.literal.unassigned.0" name="Not Assessed" null="true"/>
<literal icon="processattachment:/enumeration/low.gif" id="risk.impact.literal.1" name="Very Low"/>
<literal icon="processattachment:/enumeration/low.gif" id="risk.impact.literal.2" name="Low"/>
<literal icon="processattachment:/enumeration/medium.gif" id="risk.impact.literal.3" name="Medium"/>
<literal icon="processattachment:/enumeration/high.gif" id="risk.impact.literal.4" name="High"/>
<literal icon="processattachment:/enumeration/high.gif" id="risk.impact.literal.5" name="Very High"/>
</enumeration>

I uploaded the ExpsureProvider.js sample to the attachments for the project area with the path /workitem/scripts/common/ExposureProvider.js

However, when I create a new Task and select a value for Risk Impact and Risk Probability, the exposure does not get updated. Saving doesn't change that. Am I missing something, or is there a way to debug why this is not working?

Thanks in advance.

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

Question asked: Apr 27 '10, 1:48 p.m.

Question was seen: 5,284 times

Last updated: Apr 27 '10, 1:48 p.m.

Confirmation Cancel Confirm