cancel
Showing results for 
Search instead for 
Did you mean: 

Set attrribute of type int(ER.- CANNOT CONVERT FROM INT TO OBJECT TO INT?)

Former Member
0 Kudos

Hi All,

I am genrating a table dynamically in domodify.

Data has to come from backend in doinit().

all the attributes (dynamically generated) are of type int.

when setting the value of a attribute its allowing to enter object type only.

Object obj=resultset.getstring(1);///here value is string type

wdContext.nodeA.setattributevalue("att"+i,obj);//its not setting the value as the attribute is of type int.

How to do the same.

Reply as soon as possible as its urgent.

Thanks in Advance

Nishita

Edited by: nishita salver on Jan 1, 2008 10:50 AM

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Use as given below,

wdContext.nodeA.setattributevalue("att"+i,Integer.valueOf(resultset.getstring(1)));

Regards,

Amol

Former Member
0 Kudos

Hi,

Use as given below,

wdContext.nodeA.setattributevalue("att"+i,Integer.parseInt(resultset.getstring(1)));

Regards,

Amol

Former Member
0 Kudos

Thank you

Former Member
0 Kudos

I wonder if you really need to create context attributes and UI elements by code instead at design-time inside the IDE. Could you give some more details? Maybe you made it more complicated than needed.

Armin

Former Member
0 Kudos

Hi ,

Thanks for ur quick response.We have already created the attribute .now we have to set the value for that attribute.the syntax is

node.setattributevalue("name",obj);

this obj will be having the value for name attribute.

for string type of attribute its working but its not working for int and i wanna use int

Thanks in adnvance

Nishita

Former Member
0 Kudos

Hi,

You can use the following code,

Integer val=Integer.valueOf(obj);// where obj is a String

Then set the attribute as node.setattributevalue("name",val);

Kind Regards

Saravanan K

Former Member
0 Kudos

hi Saravanan,

We have already tried this.

Actually you can not pass the integer when setting the value for an attrubute (when created dynamically).

It asks for object type to be intered.

val will obviously hav the int value that is in obj but we can not pass val we have to pass obj(as per syntax).

We have to create ui elements dynamically because the no. of columns is changing at run time.

Is there any other way when we can keep int value in object itself.

BTW Thanks for ur response.

Deepak

Former Member
0 Kudos

Hi,

By the way you can create attribute

IWDNodeInfo node=wdContext.getNodeInfo().addChild("<Node>",null,true,true,false,false,false,true,null,null,null);

node.addAttribute("<attribname>","com.sap.dictionary.integer");

You can parse the string to type integer and assign this to the integer attribute

Regards,

Saravanan K

Edited by: Saravanan K on Jan 1, 2008 11:11 AM