Skip to Content
avatar image
Former Member

Regarding Dynamic Programming

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 22, 2007 at 09:59 AM

    Hi Chandran,

    please try to go through this post:

    creating-nodes-straight-under-context-dynamically

    Hope this help you.

    Vito

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 22, 2007 at 11:37 AM

    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

    Add comment
    10|10000 characters needed characters exceeded