Skip to Content
0
Former Member
Apr 09, 2008 at 08:50 AM

dynamic mapping

19 Views

Hi All,

I am creating dynamic mapping of context between comp controller and view part by using the following link.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6fdae690-0201-0010-a580-d104b459cb44

-creating only one node and one attribute say "attr1" which has value "hi" dynamically.

-mapping dynamically to view.

The problem is I can able to print the value attribute "attr1" which is mapped from comp controller to view. But unable to print the value "hi" which is set in attr1.

Com Controller Code:

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

nodeInfo.addAttribute("attr1","com.sap.dictionary.string");

IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("dynamicNode1",IWDNode.LEAD_SELECTION);

IWDNodeElement nodeElem = node.createElement();

nodeElem.setAttributeValue("attr1","hi");

node.addElement(nodeElem);

If i bind this attrinfo to an UI element, I can see the output "hi".

But I dont want to create an UI element. Just want to display the value from that attribute which is mapped from comp controller to view dynamically.

View Code:

IWDNodeInfo compNodeInfo = wdThis.wdGetExportexSampleCompController().wdGetAPI().getContext().getRootNode().getChildNode("dynamicNode1",IWDNode.LEAD_SELECTION).getNodeInfo();

IWDNodeInfo localNodeInfo1 = wdThis.wdGetAPI().getContext().getRootNodeInfo().addMappedChild("dynamicNode2",null,true,false,false,null,false,true);

localNodeInfo1.setMapping(compNodeInfo,true);

localNodeInfo1.addAttributesFromDataNode();

Iterator itr = wdThis.wdGetAPI().getContext().getRootNode().getChildNode("dynamicNode2",IWDNode.LEAD_SELECTION).getNodeInfo().iterateAttributes();

while(itr.hasNext()){

IWDAttributeInfo attrInfo = (IWDAttributeInfo)itr.next();

msgMgr.reportSuccess(attrInfo.getName() + "attrname");

In the above code, attrInfo.getName()-gives the name of the value attribute. "attr1"

Similarly I need to display the value of that attribute.

Hope I have clearly explained my problem. Please suggest some logic but not the links.

Regards,

Subashini.