how to access the data in a custon attribute (eneumeration) from rtc using rpe
![]()
Peter Osborne (29●2●16●19)
| asked Apr 05 '13, 3:48 p.m.
retagged Apr 08 '13, 6:18 p.m. by Brian Fleming (1.6k●1●19●28) 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
|
2 answers
![]()
Hello Peter,
Ralph authored a good article about Manipulating Work Item Enumeration Values
Hope this will help.
Thanks.
Eric.
|
![]()
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 |
Comments
risk_level.literal.l4
estimated_occurrence.literal.l5