Update: Vamsi pointed out that http://cars.flashmx.us/makes no longer works so I’ve updated the post to use http://www.w3schools.com/xml/cd_catalog.xml instead. I’ve also attached that file here in case w3schools drops it as well:-) Note that WordPress doesn’t allow XML files to be attached so change the extension to .xml before using it.
ClearQuest has this concept of “stateless record types” , which are basically one way to store “tables” of values to be looked up and used usually with “stateful” record types. An example of such a stateless record type is “users”, which stores user details (username, full name, email, privileges etc). This is quite a useful concept and all users can do to these stateless records is Submit, Modify, Delete, and Import.
As usual what is a good thing is easily abused. One way CQ’s stateless record types are often abused is they are used to duplicate information that is already stored elsewhere. The “abuse” occurs because the “elsewhere” is the actual source of truth for that information and it becomes a headache to keep the the values in synch.
RTC doesn’t quite have this concept of stateless record types though you can simulate this by setting up work item types that only have a few states and a few actions. What I prefer is the idea that the data should remain in it’s original source of truth and used from there as required, without messy copying, duplicating and synchronising. Of course there are potential performance implications with retrieving remote vales and problems with data sources not making required data available but in the main this is a better way.
An example is integrating RTC with Rational Asset Manager, where RAM stores details of product releases and applications. An RTC work item might need to specify that it depends on, is related to, or affects one of these assets and a user needs to be able to (for example) select a value from a list that is provided by RAM. Given that we don’t want to be duplicating the information from RAM, the “HTTP Filtered Value Set Provider” is a great way to do this and best of all requires no programming. More details of using this facility is in Customization of Work Items in Rational Team Concert. With the help of the examples and the Simple XPath online tester, I found it very easy to setup attributes that retrieved values from an XML document provided by RAM, filter them based on values set for other work item attributes and so on.
I was reading this topic on the Jazz.net forum and (as always!) Ralph was all over it:-) It did trigger a thought that the dependency requirement could be satisfied using the filtering capabilities, assuming that both the source and target “enumeration” values were provided by HTTP providers. So I set out to see if this would work.
Using the example in “HTTP Filtered Value Set Provider” and the XML provided by http://www.w3schools.com/xml/cd_catalog.xml I wanted to create an attribute “cd” that would list the makes depending on what value was selected for another attribute “cdcountry”, the values for which were (conveniently) provided by http://www.w3schools.com/xml/cd_catalog.xml.
First I created a HTTP Value set provider called “CDCountryProvider” configured as follows:
The Row Xpath expression is thanks to this post to get distinct values only.
(Note that there is a Test button at the bottom of that configuration pane to make sure the right values are being retrieved.)
Next I created a string custom attribute called “cdcountry” and set its value set to be CDCountryProvider.
After adding a presentation (to Defect for example) to allow the user to select a country, I repeated the exercise for CD titles. The CDTitleProvider value set provider for Titles is slightly different from the country one:
Specifically the Row Xpath is set to filter and provide titles for only those CDs that contain the value selected for the country attribute.
Next I added a string custom attribute called “cdtitle” with it’s value provider as CDTitleProvider and added a dependency to the “cdcountry” attribute:
After adding the presentation for the cdtitle attribute, I tested it out and to my surprise it worked!
Selecting region “USA”, EU” or “Norway” for “cdcountry” showed the following values for cdtitle respectively: