cancel
Showing results for 
Search instead for 
Did you mean: 

Add value to dynamic created attribute

Former Member
0 Kudos

Hi,

i have create a node and put in it some attributes, but i don't know how i can add a value to a new attribute.

	/** create a node **/
	IWDNodeInfo parent = wdContext.getNodeInfo();		
	resourceNode =  parent.addChild("resoureNode",null,true,true,true,false,false,true,null,null,null);

	/** create some attributes **/
	for (int i = 0; i < node.size(); i++)
		resourceNode.addAttribute("FileResource"+i,"com.sap.ide.webdynpro.uielementdefinitions.Resource");
	
	/** add value to a created attribute**/		
	????

regards,

sharam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

wdContext.getChildNode("nodename",0).getElementAt().setAttributeValue("attrname",attr value)

P.S : Dynamic loading of file stream data ought to have a simpler method.. Will get back to u on that

Regards

Bharathwaj

Answers (3)

Answers (3)

former_member189631
Active Contributor
0 Kudos

Hi Sharam,

Solved your Issue ?

former_member189631
Active Contributor
0 Kudos

Sharam,

Try this,

<b>Syntax:</b>

<NodeName>.getCurrentElement().setAttributeValue("AttributeName","Value");

<b>Example:</b>

resourceNode.getCurrentElement().setAttributeValue("FileResource1","sap.txt");

Regards,

Ramganesan K.

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

as you have created node "resourceNode" and directly added to context, which has attribute "FileResource", to set its value code as follow,

IWDNode node = wdContext.getChildNode("resourceNode",0);//a node name &

//element no of of that nodes element collection

IWDNodeElement nodeElement = node.getCurrentElement();

// to set the attribute value do as follows

nodeElement.setAttributeValue("FileResource",<its value>); //set its value here

you can also take use of this doc for dynamic querie,

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/74cda090-0201-0010-6b91-f85b2489...

hope it helps

regards