on 02-05-2009 7:45 AM
Hi,
I have an attribute for whose type I need to decide dynamically in runtime.
I have defined two simple types x and y in local dictionary with some predefined enumeration.
I have an attribute x bound to a dropdown by key (selected key).
Why the application I need to show either x or y in the dropdown on some condition.
Can anyone tell me the code for this if this is possible
Ashok
Hi Ashok,
try the foolowing code
public void onActionfill(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionfill(ServerEvent)
String str = wdContext.currentContextElement().getX();
if(str.equalsIgnoreCase("1"))
{
IModifiableSimpleValueSet svs = wdContext.getNodeInfo().getAttribute("value").getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
IModifiableSimpleValueSet svs1 = wdContext.getNodeInfo().getAttribute("firsttype").getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
svs.clear();
for(int i = 0 ; i < svs1.size(); i++)
{
svs.put(svs1.getKey(i),svs1.getText(i));
}
}
else
{
IModifiableSimpleValueSet svs = wdContext.getNodeInfo().getAttribute("value").getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
IModifiableSimpleValueSet svs2 = wdContext.getNodeInfo().getAttribute("secondtype").getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
svs.clear();
for(int i = 0 ; i < svs2.size(); i++)
{
svs.put(svs2.getKey(i),svs2.getText(i));
}
}
//@@end
}
there are three simple types present firsttype ,secondtype and value.
value is the type assigned to the particular context variable bound to the dropdownbykey
now on some condition you can assign the either of the two types to the value simpletype and it will be filled in the dropdown.
Thanks,
Sarbjeet Singh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.