Welcome to the Jazz Community Forum
How can I use Project Area in XPath for Value Set?

I would like to use something like the following to find the correct project in my XML:
</p>
<p>
</p>
<pre>
values/project[@name='${com.ibm.team.workitem.attribute.projectarea.value}']/build_numbers/build_number
</pre>
<p>
</p>
<p>
When testing this, the value used for this variable appears to be blank (i.e. [@name = '']).
</p>
<p>
I have also tried
</p>
<pre>
com.ibm.team.workitem.attribute.projectarea.label
</pre>
which throws an error when testing, and
<pre>
projectarea.value
</pre>
which has the same result as above.
<p>
</p>
<p>
My XML file is properly formatted as when I use the actual Project Name instead of the variable everything works fine.
</p>
<p>
Also note, I am not able to use the value from ANY attribute using this method. If I change the id above the result is the same. Perhaps my syntax is wrong, but it would be nice if the documentation for this told you where to look to find id's of the available attributes.
</p>
2 answers

Comments

Hi Ralph, thanks for the post. It would be great if more information like this was referenced by the online help or easier to find in Jazz.net searches. I couldn't find any examples beyond the one found here (many other sources reference the same exact example. This example doesn't explain how to find the id of the attributes that you can use in the path. I was able to figure this out on my own. The answer is attached.

I was able to figure this out on my own after much painstaking trial and error. Based on the following line of XML from the process configuration for the project:
<attributedefinition id="com.ibm.team.workitem.attribute.projectarea" type="projectArea" readonly="true" name="Project Area"></attributedefinition>
You would expect that the 'id' field here is the reference for the XPath, but instead you use the 'type' field, in this case 'projectArea'. I could not find any documentation ANYWHERE that explains this, so if you are trying to figure this out for yourself I hope you are able to stumble across this post.
So the actual line of code I used in my XPath Value Set was:
values/project[@name='${projectArea.label}']/build_numbers/build_number
You can also use 'projectArea.value' if you want the Project Identifier instead.
This next paragraph is to help people google this post based on searches I tried hoping to find any information on this topic.
RTC custom value set xpath, RTC custom value set examples, RTC work item customization, RTC xpath variables
Comments

You can open the Web UI for the process configuration and go to work items. You can select an attribute and click edit and see and copy paste the ID of the attribute.

Hi Ralph, that is correct. However, the "ID" is NOT used in this query. If you use the ID the query fails. You need the "type" as I mentioned above, which is not listed in the attribute properties. The only place I could find this value was in the XML source configuration.
Comments
Donald Nong
Feb 18 '16, 10:56 p.m.I cannot recognize the data source. What does your XML file look like?
Stephen Valliere
Feb 22 '16, 8:16 a.m.The question is about proper usage of the attributes from RTC, the XML source can be anything this is just an example.