cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Dynamic Programming

Former Member
0 Kudos

Hi Experts

I had created one Context Dynamically in wdDoInit() method in The View Controller.

Can anyone tell me how to add the values dynamically to that dynamically created Context.

Regards

Chandran S

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chandran,

please try to go through this post:

Hope this help you.

Vito

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi chandran..

You can do this by the following..

In the component controller wddoInit() Method write this piece of code

IWDNodeInfo India = wdContext.getNodeInfo().addChild("India",null,true,true,false,false,false,true,null,null,null);

IWDAttributeInfo City = India.addAttribute("City" , "ddic:com.sap.dictionary.string");

IWDNode NodeIndia = wdContext.getChildNode("India",0);

NodeIndia.getCurrentElement().setAttributeValue("City","Mumbai");

Now create and context map a Node in the View Controller

Write this piece of code in the View controller wddoInit() Method

IWDNodeInfo NodeInfo = wdContext.getNodeInfo().addMappedChild("Bharath",null,true,true,false,null,false,true);

IWDNodeInfo CompNode = wdThis.wdGetDynMapController().wdGetContext().getNodeInfo().getChild("India");

NodeInfo.setMapping(CompNode,true);

IWDAttributeInfo AttInfo = CompNode.getAttribute("City");

IWDAttributeInfo NewAtt = NodeInfo.addMappedAttribute("City",".DynMap.India.City"); //Please Note that DynMap is the Name of the Component, India is the Node and the City is the attibute

IWDNode N1 = wdContext.getChildNode("Bharath",0);

wdComponentAPI.getMessageManager().reportSuccess(N1.getCurrentElement().getAttributeAsText("City"));

When the value is set for an attribute in the Component Controller, you will be able to access it from the View Controller

Hope this will help you..

Urs GS