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

Risk Exposure Example Query

The Risk Exposure example posted on https://jazz.net/wiki/bin/view/Main/AttributeValueProviders#Examples works now in my environment.Hoewever there is small change required in the calculation. In the line where multiplication of impact and probability is returned, what we want is a decimal value like this: return impact * (probability / 100). We want to have probability value divided by 100 and then multiplied to impact value. When I do this it doesnot show the change. Probably it is not reading a decimal value. What needs to be done to implement this.

0 votes



11 answers

Permanent link
The Risk Exposure example posted on
https://jazz.net/wiki/bin/view/Main/AttributeValueProviders#Examples
works now in my environment.Hoewever there is small change required
in the calculation. In the line where multiplication of impact and
probability is returned, what we want is a decimal value like this:
return impact * (probability / 100). We want to have probability
value divided by 100 and then multiplied to impact value. When I do
this it doesnot show the change. Probably it is not reading a decimal
value. What needs to be done to implement this.

We currently don't support floating point custom attributes, only
Integer and Long.

See
https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/61040

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link

We currently don't support floating point custom attributes, only
Integer and Long.

See
https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/61040

--
Regards,
Patrick
Jazz Work Item Team


Are there options for converting the value to a string and then displaying the string as a presentation?

What would the steps be to implement this?

0 votes


Permanent link
Are there options for converting the value to a string and then
displaying the string as a presentation?

What would the steps be to implement this?

There are two options that are both not optimal:

1) Use an attribute of type string and modify the value calculator to
return a string.
--> You lose the ability to query for 'risk > x'

2) Write a presentation for numbers that divides the number by a certain
factor.
--> This would need to be done both for the Eclipse UI and Web UI
--> Currently it is not possible to provide a custom presentation for
the query results

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link

There are two options that are both not optimal:

1) Use an attribute of type string and modify the value calculator to
return a string.
--> You lose the ability to query for 'risk > x'

2) Write a presentation for numbers that divides the number by a certain
factor.
--> This would need to be done both for the Eclipse UI and Web UI
--> Currently it is not possible to provide a custom presentation for
the query results

--
Regards,
Patrick
Jazz Work Item Team


What is the syntax in the JS to perform #1?

0 votes


Permanent link
What is the syntax in the JS to perform #1?

Say you have impact and probability and you calculate a float like this:

var risk = impact * probability / 100;
return risk.toFixed(2);

This would return a string with two digit precision.

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
I tried to implement the toFixed() method in ExposureProvider.js but it doesnot give the desired output.It throws the error.

I Tried:
var exposure = impact * (probability / 100);
return exposure.toFixed(2);

Also, in Process Configuration Source (XML), in the value Providers I retured Risk Exposure as string type instead of long.

The error I am recieving is as below:

java.lang.ClassCastException: java.lang.String incompatible with java.lang.Double
at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.convert(ScriptAttributeValueProvider.java:90)
at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.getValue(ScriptAttributeValueProvider.java:56)
at com.ibm.team.workitem.common.internal.attributeValueProviders.AttributeValueProviderRegistry$SafeValueProvider.getValue(AttributeValueProviderRegistry.java:42)
at com.ibm.team.workitem.common.internal.model.impl.AttributeImpl.getValue(AttributeImpl.java:857)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:596)
at $Proxy21.getValue(Unknown Source)
at com.ibm.team.workitem.client.internal.DependencyHandler$Worker.runProtected(DependencyHandler.java:51)
at com.ibm.team.foundation.client.util.FoundationJob.run(FoundationJob.java:68)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Please suggest what else can be tried on to get the correct output?

0 votes


Permanent link
I tried to implement the toFixed() method in ExposureProvider.js but
it doesnot give the desired output.It throws the error.

I Tried:
var exposure = impact * (probability / 100);
return exposure.toFixed(2);

Also, in Process Configuration Source (XML), in the value Providers I
retured Risk Exposure as string type instead of long.

The error I am recieving is as below:

java.lang.ClassCastException: java.lang.String incompatible with
java.lang.Double

Please suggest what else can be tried on to get the correct output?

I mistakenly thought that toFixed would return a string. You can
explicitly return a String using:

return new String(exposure.toFixed(2));

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link

I mistakenly thought that toFixed would return a string. You can
explicitly return a String using:

return new String(exposure.toFixed(2));

--
Regards,
Patrick
Jazz Work Item Team


This did not work either. Error output:

java.lang.ClassCastException: org.mozilla.javascript.NativeString incompatible with java.lang.Double
at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.convert(ScriptAttributeValueProvider.java:90)
at com.ibm.team.workitem.shared.common.internal.valueProviders.ScriptAttributeValueProvider.getValue(ScriptAttributeValueProvider.java:56)
at com.ibm.team.workitem.common.internal.attributeValueProviders.AttributeValueProviderRegistry$SafeValueProvider.getValue(AttributeValueProviderRegistry.java:42)
at com.ibm.team.workitem.common.internal.model.impl.AttributeImpl.getValue(AttributeImpl.java:857)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:596)
at $Proxy21.getValue(Unknown Source)
at com.ibm.team.workitem.client.internal.DependencyHandler$Worker.runProtected(DependencyHandler.java:51)
at com.ibm.team.foundation.client.util.FoundationJob.run(FoundationJob.java:68)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

0 votes


Permanent link
This did not work either. Error output:

java.lang.ClassCastException: org.mozilla.javascript.NativeString
incompatible with java.lang.Double

And you are sure your value provider is now bound to a string attribute?
And not the Integer based one that you used before? The converter is
based on the attribute type and it looks like you use the same setup but
now return a string instead of an number.

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link
And you are sure your value provider is now bound to a string attribute?
And not the Integer based one that you used before? The converter is
based on the attribute type and it looks like you use the same setup but
now return a string instead of an number.

--
Regards,
Patrick
Jazz Work Item Team


Yes, confirmed. It is set to "string"

0 votes

1–15 items
page 1of 1 pagesof 2 pages

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: Feb 01 '10, 5:14 a.m.

Question was seen: 11,991 times

Last updated: Feb 01 '10, 5:14 a.m.

Confirmation Cancel Confirm