RTC Calculated Script Clarification
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.
Factors
Enumeration Attribute for Factor A Yes (25) No (0)
Enumeration Attribute for Factor B Yes (25) No (0)
Enumeration Attribute for Factor C Yes (25) No (0)
Enumeration Attribute for Factor D Yes (5) No (0)
Enumeration Attribute for Factor E Yes (5) No (0)
Enumeration Attribute for Factor F Yes (5) No (0)
Enumeration Attribute for Factor G Yes (5) No (0)
Enumeration Attribute for Factor H Yes (5) No (0)
Enumeration Attribute for Calculating Total = A B
If the evaluation result is higher than 50 , the result is A. If the evaluation result is less than 50 , the result is B.
|
5 answers
Ralph Schoon (63.3k●3●36●46)
| answered Mar 28 '23, 4:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER 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.
Comments
RTC User Prime
commented Mar 28 '23, 9:47 a.m.
Updated the clarification by having them aligned.
Ralph Schoon
commented Mar 28 '23, 10:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I stand by my answer. You can compare enumeration values for multiple attributes, do the calculation above and return the enumeration value based on the comparison from the choice A and B.
RTC User Prime
commented Mar 29 '23, 6:34 a.m.
|
The below script is not working. Please let me know if anything is wrong
dojo.provide("com.ibm.alinma.rtc.calculatedScript.evaluationresult"); |
Ralph Schoon (63.3k●3●36●46)
| answered Mar 29 '23, 6:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Mar 30 '23, 3:41 a.m. 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.
In addition to that, I would like to suggest to you that if a function was to return a value, you should probably return a value in one of the last statements at the end of your function. I would suggest you consider debugging your script ( https://rsjazz.wordpress.com/2022/11/17/debugging-ewm-work-item-attribute-customization-javascript/ ) link to be found in the post mentioned above.
|
Thanks Ralph
With the links provided, I was able to crack the script by using the debugging method as the ready only enumerated field is getting updated based on the selection. The only issue is that the logic seem to be missing as I suspect the way the addition and updation is not correct. Can you help me on that part alone ?
Written Logic
var total = A + B + C + D + E + F + G + H;
When I select A B C D E F G H as Yes Yes No No No No No No in Sequence its working
When I select C D E H A G F B as No No No Yes No No No Yes in Random its not working.
Anything to be added to the logic to have the calculation done irrespective of the sequence of selection ?
Comments
Ralph Schoon
commented Apr 03 '23, 5:13 a.m.
| edited Apr 03 '23, 5:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There is not enough information to do a lot. Issue:
I would write the code like this
var result = "BB";
if(total>= 50){
result = "AA";
}
return result;
|
There is a small mistake as "total" and "totalPriority" are the only comparison criteria
Below is the sample code
var A = 0; . var H = 0; var total = 0; if (Req1 === "Yes" ) { A = 25; } else if (Req1 === "No" || Req1 === "Unassigned") . . . . if (Req8 === "Yes" ) { H = 5; } else if (Req8 === "No" || Req8 === "Unassigned") var total = A + B + C + D + E + F + G + H; |
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.