how to access the data in a custon attribute (eneumeration) from rtc using rpe
![](http://jazz.net/_images/myphoto/d352b394765173e518a81ea33ab60a5e.jpg)
2 answers
![](http://jazz.net/_images/myphoto/d352b394765173e518a81ea33ab60a5e.jpg)
Hello Peter,
Ralph authored a good article about Manipulating Work Item Enumeration Values
Hope this will help.
Thanks.
Eric.
![](http://jazz.net/_images/myphoto/d352b394765173e518a81ea33ab60a5e.jpg)
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
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
Peter Osborne
Apr 05 '13, 4:55 p.m.risk_level.literal.l4
estimated_occurrence.literal.l5