on 10-28-2010 12:53 PM
Dear All
I thought this was going to be straightfoward and am obviously missing something.
I have created a simple modifiable value set to create a dropdown list to select a country:
public void GetCountryDropDownValues( )
{
//@@begin GetCountryDropDownValues()
Y_Tf_Npf_Get_Countries_Input countriesInput = new Y_Tf_Npf_Get_Countries_Input();
wdContext.nodeY_Tf_Npf_Get_Countries_Input().bind(countriesInput);
try {
countriesInput.execute();
wdContext.nodeY_Tf_Npf_Get_Countries_Input().nodeOutput_countries().invalidate();
} catch (WDRFCException ex) {
// TODO: handle exception
}
IPrivateNonPersonalisedLearnAdminReq.IContextElement elem = wdContext.currentContextElement();
String strObjElem0 = elem.COUNTRY;
IWDAttributeInfo i_ObjType0 = wdContext.getNodeInfo().getAttribute(strObjElem0);
ISimpleTypeModifiable w_ObjType0 = i_ObjType0.getModifiableSimpleType();
IModifiableSimpleValueSet s_ObjType0 = w_ObjType0.getSVServices().getModifiableSimpleValueSet();
s_ObjType0.clear();
for(int i=0;i<wdContext.nodeEt_Countries().size();i++)
{
IPublicNonPersonalisedLearnAdminReq.IEt_CountriesElement elemOrg = wdContext.nodeEt_Countries().getEt_CountriesElementAt(i);
s_ObjType0.put(elemOrg.getLand1(),elemOrg.getLandx50());
}
//@@end
}
This is bound to a new context element attribute:
Country of type string
When value is selected from dropdown, it is stored in string
What I want to be able to do is to retrieve the text as well as the key from the selected object.
At the moment I can only return the key.
i.e. wdContext.currentContextElement().getCountry();
Any pointers will be greatfully received and maximum points awarded to the first complete
answer that works for me.
Many thanks in advance
Mike
Hi,
You can use the following code.
ISimpleValueSet valueset = attInfo.getModifiableSimpleType().getSVServices().getValues();
if(valueset.containsKey(key)){ // Give your key here, which you already know to retrieve
String value = valueset.getText(key); // Here you will get the value
Hope it helps.
Regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.