Help with a custom work item attribute “Calculated Value”
![]() Hi,
Testing out a potential use of a calculated value attribute in RTC. I’m not much of a coder and I think I’m having issues with attribute types/Variable types.
I have two attributes: rate (decimal) and qty (integer). I want to multiply the two in a scripted calculated value provider and save it as an attribute cost (decimal).
Using workItem.getValue(attributeID) I’m struggling to extract the numbers to use in the simple calculation. Can anyone help?
Thanks
Glyn
|
Accepted answer
![]()
Ralph Schoon (62.3k●3●36●43)
| answered Jan 28 '22, 2:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Support case was opened. Case is closed, there was an issue with the process configuration, as already hinted here.
This caused the null value for the attribute.
Ralph Schoon selected this answer as the correct answer
Comments
thank you for your help.
FYI, I was not editing the process source, only through UI. But hey ho.
Does not matter how you edit, it is a process source at the end.
Pleas share questions like this with support in the case next time. Thanks!
|
3 other answers
![]()
Ralph Schoon (62.3k●3●36●43)
| answered Jan 27 '22, 3:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER In addition to Davyds answer, please
1. Have a look at https://www.w3schools.com/js/default.asp The site has helped me greatly with tips.
2. Learn how to use the Chrome Debugger
The debugger can be used this way:
Open the work item menu for your project area in Chrome.
Inject ?debug=true into the URL in front of the #
e.g. https://elm.example.com:9443/ccm/web/projects/JKE Banking (Change Management)?debug=true#action=com.ibm.team.workitem.viewWelcome and run the tab again.
Use CTRL+SHIFT+I to open the developer tools.
Use the three vertical dots to the right of the cogwheel to change the location of the developer tools to the bottom.
Select the Sources tab.
Use a query or the Search Work Items to locate a work item or create one.
You will see two cloud icons, one shows your server and port e.g. elm.example.com:9443 and another that shows "(no domain)"; open the latter one. Find your calculated value script and open it. Set a breakpoint in the beginning.
When the script is run, the page will stop and you can step through the script. You can hover over variables to understand their form, types and values.
If you change the script and save it in Eclipse, make sure to completely reload the page in the browser to get the newest script version.
You can now debug your script (note does not work for default value scripts).
|