It's all about the answers!

Ask a question

How to config HTTP Filtered Value Set to handle dependency


Dong Young Kim (1931820) | asked Oct 20 '11, 4:35 a.m.
JAZZ DEVELOPER
I made two attributes : car, area (depends on car)

Here is sample XML for car & area

<xml>
<node><id>1</id>
<make>Acura</make>
<areas>
<area><name>Acura1</name></area>
<area><name>Acura2</name></area>
</areas>
</node>
<node>
<id>2</id>
<make>Aixam</make>
<areas>
<area><name>Aixam1</name></area>
<area><name>Aixam2</name></area>
</areas>
</node>
</xml>

When I select a car(Aixam) then I want to list areas(Aixam1, Aixam2) where car belongs to.

To do this, I made two value set providers.
(1) CarValueSetProvider
- XML DataSource URL : http://localhost:8080/MyCar/mycar
- Row XPath Expression : //xml/node
- Col XPath Expressions : ./make
- Col identifiers : Make
- Entry label format : ${0}
(2) AreaValueSetProvider
- XML DataSource URL : http://localhost:8080/MyCar/mycar
- Row XPath Expression : //xml/node/areas/area
- Col XPath Expressions : ./name
- Col identifiers : Area
- Entry label format : ${0}

'car' works but 'area' disabled!
What would be the problem?
(I'm testing RTC 3.0.1.1 RC3)

9 answers



permanent link
Dong Young Kim (1931820) | answered Jul 17 '12, 10:25 p.m.
JAZZ DEVELOPER

permanent link
Nils Kronqvist (4162) | answered Oct 26 '11, 9:24 a.m.
JAZZ DEVELOPER
The way I read https://jazz.net/wiki/bin/view/Main/DataSourceValueSetProviders#The_HTTP_Filtered_Value_Set_Prov it seems that the ability to access a label/value of an attribute is available in RTC 3.5 M4, but not in RTC 3.0.1.1.

Rgs,

/N

permanent link
Dong Young Kim (1931820) | answered Oct 26 '11, 10:15 p.m.
JAZZ DEVELOPER
Thx for the information.

For the time being, I would have to use script based value set.
Here are my sample script to do it.

dojo.provide("org.example.workitems.providers.MyCarAreaValueSet");
dojo.require("com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters");
(function() {
var HttpConnectorParameters= com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters;
dojo.declare("org.example.workitems.providers.MyCarAreaValueSet", null, {
getFilteredValueSet: function(attributeId, workItem, context, filter) {
var params= new HttpConnectorParameters();
var car = workItem.getValue("car");
var xpath = "//xml/node/areas/area";
params.url= "http://localhost:8080/MyCar/mycar";
params.xpath= xpath;
params.columnXpaths= ;
params.columnIds= ;

var connector = context.getDataConnector("HttpConnector");
var values= connector.get(params);

var result= [];
while(values.hasNext()){
var entry= values.next();
var area= entry.getById("Area");
result.push(area);
}
return result;
}
});
})();

permanent link
Geoffrey Clemm (30.1k23035) | answered Oct 26 '11, 10:31 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This functionality has been patched into the 3.0.1.1 release for "early
use" by customers that have an urgent need for it, but it is not
officially released and documented until the 3.5 release. But I believe
the work item development team would like your feedback, so if something
is not working, please submit a work item describing your issue/problem.

Cheers,
Geoff

On 10/26/2011 9:38 AM, nkronqvist wrote:
The way I read
https://jazz.net/wiki/bin/view/Main/DataSourceValueSetProviders#The_HTTP_Filtered_Value_Set_Prov
it seems that the ability to access a label/value of an attribute is
available in RTC 3.5 M4, but not in RTC 3.0.1.1.

Rgs,

/N

permanent link
Nick Edgar (6.5k711) | answered Oct 28 '11, 4:45 p.m.
JAZZ DEVELOPER
The basic support for HTTP value set providers was backported to 3.0.1.1, but the support for substituting variables in the URL (without resorting to scripting) got added later and is only in as of 3.5 M4.

Glad to hear you were able to get it working via scripting.

The scenario you describe of having dependent attributes affecting the URLs will be a common one, I believe, so it's important that we get it working correctly, e.g. invalidating a downstream attribute and updating its list of possible values when an upstream attribute changes.

Please file work items if it's not working as expected.

permanent link
Fausto Lemos (16811518) | answered Jul 17 '12, 2:35 p.m.
hello guys,

in Dong Young example, how could i reset the second enumeration (areas) if the first one is changed? i try to put a CalculatedValue at the "areas" but dont work..

Dong, you choose "Value Set Picker" or "Value Set Combo" for the second list?

tks!



permanent link
Fausto Lemos (16811518) | answered Jul 17 '12, 2:37 p.m.
One more info, i'm using RTC 3.0.1.3

permanent link
Fausto Lemos (16811518) | answered Jul 17 '12, 6:47 p.m.
I made more tests in RTC 3.0.1.3 and realize that:
            - using the second list as "Value Set Combo" works fine in Eclipse Client and when a i change the first list the second is reloaded and validated ( red cross indicating that selected value is invalid). But at web client the second list is loaded only once no mather what you do with the first list...

           - using the second list as "Value Set Picker" works fine in all cases (the service of second list is called whenever we type a letter..) except that rtc don't validate cases when the second list is set and the first one is changed.. so old values are "allowed"..

am i missing some step in first case or only using "Value Set Picker" is the way? In this case there is a option to clear this second list?

permanent link
Fausto Lemos (16811518) | answered Jul 17 '12, 10:56 p.m.
Dong, in your implementation you use "Value Set Picker" ? if so, how do you clear the second list if the user change the first one? i'm asking because if user select car Akura and then Acura1, and after change car to Aixam, the second field isn't automatically cleared.. did you have the same problem?

Your answer


Register or to post your answer.