on 08-01-2007 3:04 PM
Hi all,
I have one doubt, Can I map the drop down by key to a integer type attribute?
In the properties of drop down by key I mapped "selected Key" property to a "int" type value attribute, and its giving following error....
java.lang.IllegalArgumentException: Cannot format given Object as a Number
at java.text.NumberFormat.format(NumberFormat.java:219)
at java.text.Format.format(Format.java:133)
at com.sap.dictionary.runtime.DdTypeNumber.format(DdTypeNumber.java:48)
at com.sap.dictionary.runtime.DdSimpleType.toString(DdSimpleType.java:335)
at com.sap.tc.webdynpro.progmodel.context.ModifiableSimpleType.toString(ModifiableSimpleType.java:936)
Could any one explain me the problem.
Note: same is working if I map it to a "string" type attribute.
my dropdown by key code is
if(wdContext.nodePstatus_out().size()!=0)
{
IWDAttributeInfo pStatAttInfo=wdContext.nodePstatus_out().getNodeInfo().getAttribute("Zad_Counter");
ISimpleTypeModifiable pStatSMT= pStatAttInfo.getModifiableSimpleType();
IModifiableSimpleValueSet pStatSimpValSet= pStatSMT.getSVServices().getModifiableSimpleValueSet();
pStatSimpValSet.clear();
//pStatSimpValSet.put(null,null);
if(wdContext.nodePstatus_out().size()>0)
{
for(int pCount=0; pCount<wdContext.nodePstatus_out().size();pCount++)
{
pStatSimpValSet.put(Integer.toString(wdContext.nodePstatus_out().getPstatus_outElementAt(pCount).getZad_Counter()),wdContext.nodePstatus_out().getPstatus_outElementAt(pCount).getZad_Char_Text());
}
}
}
Here "zad_Counter" is the integer type value attribute.
regards,
Pradeep
Hi Pradeep,
As you are using integer as type, you should pass <b>Integer</b> object as key. Try the following:
pStatSimpValSet.put(<b>new Integer</b>(wdContext.nodePstatus_out().getPstatus_outElementAt(pCount).getZad_Counter()), wdContext.nodePstatus_out().getPstatus_outElementAt(pCount).getZad_Char_Text());
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abilash,
My problem is solved. But one small thing left out...
Actually on click of "clear all" button, I am clearing the drop down by keys. previously there was all string type attributes mapped to drop down by keys, so what I did is...
wdcontext.currentNODE.setXXX(" ");
with above line I cleared all the dropdowns previously.
But now, I mapped drop down to Integer type, so I can not use above line to print empty space (to clear). What I need to do to clear the drop down by key.
Thanks n regards
Pradeep
Hi Pradeep,
We can not use integer type to map to key/index of drop down. you need to type cast to string like <integer>+"".
regards
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pradeep,
I mean you can not use <int> type because put accepts (Object,String) but you can use (String, String). I think you are getting problem because it is not going into loop. Before loop do as the following
put(" ", "Select any value");
// Don't use put(null,null); it will cause same probelm
Hope it will resolve your problem.
regards,
Siva
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.