It's all about the answers!

Ask a question

how to access the data in a custon attribute (eneumeration) from rtc using rpe


0
1
Peter Osborne (2921619) | asked Apr 05 '13, 3:48 p.m.
retagged Apr 08 '13, 6:18 p.m. by Brian Fleming (1.6k11928)

I have 2 custom attributes of the type enumeration for defects.  1 is used to set the probability of occurrence for the defect and the other is to set the risk level.

Example: 

Estimated Occurrence is 2 - Improbable

Risk Level is 4 - ALARP


Comments
Peter Osborne commented Apr 05 '13, 4:55 p.m.

risk_level.literal.l4

 

estimated_occurrence.literal.l5

2 answers



permanent link
Eric Jodet (6.3k5111120) | answered Apr 08 '13, 8:05 a.m.
JAZZ DEVELOPER
 Hello Peter,
Ralph authored a good article about Manipulating Work Item Enumeration Values

Hope this will help.

Thanks.
Eric.

permanent link
Brian Fleming (1.6k11928) | answered Apr 08 '13, 6:20 p.m.
edited Apr 09 '13, 7:30 a.m.
Since RPE 1.2, you can pass complex variables between scripts.  I use this method to construct a hashtable, stored in an RPE internal variable, containing the enumeration identifiers and literals, then read from the hashtable when I need to translate the identifier stored in a workitem attribute with the actual literal.

To create the hashtable, I use a scripted variable under these nested queries:
workitem/projectArea (with a native filter of name='<projectAreaName>')
  workitem/projectArea/enumerations (with a scripted filter of id == "valueprovided" )
    workitem/projectArea/enumerations/literals

My variable is then populated by this script:
java.util.Hashtable(myHashtable).put(id,name);
myHashtable


I then execute this query:
workitem/workItem/StringExtensions
and under that query populate another internal variable that I eventually use to output the enumeration literal.  This is the script I use to populate the second internal variable:

if (key=="<workItemAttributeIdentifier>")
{
output= java.util.Hashtable(myHashtable).get(value);
}
output


I would be interested in hearing if anyone has found a simpler way to do this. 

Note that if you are using a version of RPE prior to 1.2, you would need to serialize/deserialize the hashtable in order to pass it between scripts.  This is discussed here: https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14873579

Your answer


Register or to post your answer.