It's all about the answers!

Ask a question

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

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.


Estimated Occurrence is 2 - Improbable

Risk Level is 4 - ALARP

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




2 answers

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

Hope this will help.


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" )

My variable is then populated by this script:

I then execute this query:
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);

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:

Your answer

Register or to post your answer.