RTC Calculated Script Clarification
![](http://jazz.net/_images/myphoto/9c7c44b9c9d38c39803057302a783773.jpg)
Is it possible to have RTC Calculated Script for the below using enumerations. where Factor A to Factor H are having specific values, where in the below calculation is done and the result would be a Read-only Enumeration on a specific state.
5 answers
![](http://jazz.net/_images/myphoto/9c7c44b9c9d38c39803057302a783773.jpg)
The question is barely readable and does not make any sense to me. It should be easy enough to create a presentation and a pseudo algorithm that explains what you want.
Regardless, it is possible to create a calculated value for an enumeration attribute. The editor presentation for that attribute can be read only. The calculated value can access other attributes and operate on their values.
![](http://jazz.net/_images/myphoto/9c7c44b9c9d38c39803057302a783773.jpg)
dojo.provide("com.ibm.alinma.rtc.calculatedScript.evaluationresult");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function ()
{
dojo.declare("com.ibm.alinma.rtc.calculatedScript.evaluationresult", null,
{
getValue: function (attribute, workItem, configuration)
{
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var A = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.A");
var B = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.B");
var C = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.C");
var D = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.D");
var E = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.E");
var F = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.F");
var G = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.G");
var H = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.H");
var Result = workItem.getLabel("com.ibm.team.workitem.initiative.customattribute.samplePA.EvaluationResult")
var total = 0;
if (A === "Yes" )
{
A_Value = 25;
}
else if (A === "No" || A === "Unassigned")
{
A_Value = 0;
}
if (B === "Yes" )
{
B_Value = 25;
}
else if (B === "No" || B === "Unassigned")
{
B_Value = 0;
}
if (C === "Yes" )
{
C_Value = 25;
}
else if (C === "No" || C === "Unassigned")
{
C_Value = 0;
}
if (D === "Yes" )
{
D_Value = 25;
}
else if (D === "No" || D === "Unassigned")
{
D_Value = 0;
}
if (E === "Yes" )
{
E_Value = 5;
}
else if (E === "No" || E === "Unassigned")
{
E_Value = 0;
}
if (F === "Yes" )
{
F_Value = 5;
}
else if (F === "No" || F === "Unassigned")
{
F_Value = 0;
}
if (G === "Yes" )
{
G_Value = 5;
}
else if (G === "No" || G === "Unassigned")
{
G_Value = 0;
}
if (H === "Yes" )
{
H_Value = 5;
}
else if (H === "No" || H === "Unassigned")
{
H_Value = 0;
}
// Criteria Contribution Weights:
// 1. A 25%
// 2. B 25%
// 3. C 25%
// 4. D 5%
// 5. E 5%
// 6. F 5%
// 7. G 5%
// 8. H 5%
// TOTAL 100%
var totalPriority = (A_Value + B_Value + C_Value + D_Value + E_Value + F_Value + G_Value + H_Value);
if (totalPriority >= 50 )
{
EvaluationResult = "DropeDown1";
}
else if (totalPriority < 50)
{
EvaluationResult = "DropeDown2";
}
}
});
})();
![](http://jazz.net/_images/myphoto/9c7c44b9c9d38c39803057302a783773.jpg)
I would suggest you carefully read https://rsjazz.wordpress.com/2022/11/25/ewm-attribute-customization-introduction/ and maybe look into the documentation, workshop(s) and examples.
![](http://jazz.net/_images/myphoto/9c7c44b9c9d38c39803057302a783773.jpg)
Thanks Ralph
var total = A + B + C + D + E + F + G + H;
if (total >= 50 )
{
EvaluationResult = "AA";
}
else if (totalPriority < 50)
{
EvaluationResult = "BB";
}
return EvaluationResult;
}
Comments
![](http://jazz.net/_images/myphoto/e5e63d5878217b64611c1df9401b7cd3.jpg)
There is not enough information to do a lot. Issue:
- You use total and totalPriority to compare. The latter variable does not exist.
- Make sure that the value of the attribute you calculate here has all other attributes as dependency.
![](http://jazz.net/_images/myphoto/9c7c44b9c9d38c39803057302a783773.jpg)
There is a small mistake as "total" and "totalPriority" are the only comparison criteria
var A = 0;
.
var H = 0;
var total = 0;
var EvaluationResult = 0;
if (Req1 === "Yes" ) { A = 25; } else if (Req1 === "No" || Req1 === "Unassigned")
{ A = 0; }
.
.
.
.
if (Req8 === "Yes" ) { H = 5; } else if (Req8 === "No" || Req8 === "Unassigned")
{ H = 0; }
var total = A + B + C + D + E + F + G + H;
if (total >= 50 )
{
EvaluationResult = "AA";
}
else if (total < 50)
{
EvaluationResult = "BB";
}
return EvaluationResult;