It's all about the answers!

Ask a question

Help With Real-Time Calculation in RTC


Rob Olsen (3512153) | asked Jan 04 '18, 4:38 p.m.

I have an urgent need for the capability to add a bunch of integer attributes together on a modified RTC menu and then display that total in another attribute.  I believe there is a way to do this by using the "Calculated Value" setting but this would require me to know-how-to write my own Java code.  Can anyone share with me the simple Java code to do this? I am not lazy, just short of time and have not written any Java code.

I have three attributes Value1 (integer), Value2 (integer) and Value3 (integer).  All three are entered by the user. Then I have an attribute Total (integer) which s the sum of Value1 + Value2 + Value3. Is this so simple to do I am just missing it? Or is there some code that someone can share to show how to do this?

Does the Total get filled in after a "save" or "state transition" only? 

2 answers



permanent link
Ralph Schoon (63.5k33646) | answered Jan 04 '18, 5:38 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Comments
Ralph Schoon commented Jan 05 '18, 2:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please note, with respect to https://jazz.net/forum/questions/248408/using-attribute-from-one-task-and-display-as-read-only-under-another-task , you can not access other work items or their attributes n JavaScript attribute customization.


permanent link
Donald Nong (14.5k614) | answered Jan 04 '18, 7:52 p.m.

If you are really short of time, this is what you will do.
1. Create a script-based Calculated Value provider, and fill it in with the sample code.
2. Replace the sample code with the logic of reading the three integer attributes Value1, Value2 and Value3, add them together and return the total.
3. Attach the provider to attribute Total.
4. Set the attribute Total to depend on attributes Value1, Value2 and Value3, so the provider will be triggered when any of the three attributes is changed.

You can find most of the stuff here:
https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_based_calculated_values

The total number will be "displayed" straightaway when you change any Value# value, but will only persist after a Save.

Your answer


Register or 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.