How to config HTTP Filtered Value Set to handle dependency
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)
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
186425: HTTP value set provider: difference between in web and in eclipse client. seems like fixed in 4.0.
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;
}
});
})();
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;
}
});
})();
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:
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
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.
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.
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?
- 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?
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?