cancel
Showing results for 
Search instead for 
Did you mean: 

Binding Value to a value node

Former Member
0 Kudos

HI all,

I have a value node with a value Attribute which is bound to a DropDownByKey Selected Property.

Now when i bind a collection of String to this at runtime by

wdContext.nodeFilter().bind(colFilters);

i get the exception

com.sap.tc.webdynpro.progmodel.context.ContextException: NodeInfo(QueryExecution2.filter): you must bind NodeElements to a value node

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.packElement(NodeInfo.java:1073)

at com.sap.tc.webdynpro.progmodel.context.Node.packElement(Node.java:620)

at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.bind(Node.java:2008)

at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.<init>(Node.java:1898)

at com.sap.tc.webdynpro.progmodel.context.Node.setElements(Node.java:542)

at com.sap.tc.webdynpro.progmodel.context.Node.bind(Node.java:607)

at com.sap.bll.test.comp.QueryExecution2.wdDoInit(QueryExecution2.java:138)

at com.sap.bll.test.comp.wdp.InternalQueryExecution2.wdDoInit(InternalQueryExecution2.java:228)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:388)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:645)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:515)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:180)

at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.doOpen(WebDynproWindow.java:292)

at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.open(ApplicationWindow.java:232)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:403)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.getApplicationHandle(AbstractClient.java:143)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.prepareTasks(AbstractClient.java:216)

at com.sap.tc.webdynpro.clientimpl.scxml.client.SmartClient.prepareTasks(SmartClient.java:487)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:647)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.parseRequest(ClientManager.java:144)

at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.parseRequest(ApplicationHandle.java:79)

at com.sap.tc.mobile.mwd.runtime.sal.MwdDispatcher.retrieveDataBlock(MwdDispatcher.java:230)

at com.sap.platin.base.protocol.direct.GuiDirectNetConnection.processDataToServer(GuiDirectNetConnection.java:458)

at com.sap.platin.base.protocol.direct.GuiDirectNetConnection.handleDataToServer(GuiDirectNetConnection.java:192)

at com.sap.platin.base.protocol.GuiMultiplexer.processDataToServer(GuiMultiplexer.java:210)

at com.sap.platin.base.protocol.GuiMultiplexer.handleDataToServer(GuiMultiplexer.java:300)

at com.sap.platin.wdp.protocol.xml.GuiWebDynproXmlToAutomationParser.forwardXmlData(GuiWebDynproXmlToAutomationParser.java:615)

at com.sap.platin.wdp.protocol.xml.GuiWebDynproXmlToAutomationParser.processEventList(GuiWebDynproXmlToAutomationParser.java:558)

at com.sap.platin.wdp.protocol.xml.GuiWebDynproXmlToAutomationParser.handleDataToServer(GuiWebDynproXmlToAutomationParser.java:149)

at com.sap.platin.base.protocol.GuiMultiplexer.processDataToServer(GuiMultiplexer.java:210)

at com.sap.platin.base.protocol.GuiMultiplexer.run(GuiMultiplexer.java:64)

at java.lang.Thread.run(Thread.java:534)

Plz tell me how to bind values to it

Rgds,

Vilish

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vilish,

I am sorry, I just gave you the code for binding values to a value node. But you cannot use this for a dropdownbykey UI element. It can be used only for DropDownByIndex element(bind the 'texts' property of DropDownByIndex UI to the node attribute and then populate the node).

If you want to use DropDownByKey:

1) create a simple type(say 'mytype') in you local dictionary.

2) create an attribute of type 'mytype'.

3) Write the code that Noufal gave to populate the attribute.

Best Regards,

Nibu.

Former Member
0 Kudos

Hi Vilish,

As far as I know You cannot just bind string values to a node. You have to use the following code snippet to elements of a node & popuplate them.


IPrivate<your_view>.I<your_node>Node node = wdContext.node<your_node>();
IPrivate<your_view>..I<your_node>Element elmt = null;
    
    for(int i=0;i<10;i++)
    {
    	elmt = wdContext.create<your_node>Element();
    	elmt.setAttr1(value1);
    	elmt.setAttr2(value2);
        .
        .
    	node.addElement(elmt);
    }

This will populate the node with the data

Hope this helps,

Best regards,

Nibu.

Former Member
0 Kudos

I believe your requiremnet is to populate a dropdownkey.

The following cod emight be of help.

IWDAttributeInfo info=wdCOntext.node<nodename>().getNodeInfo().getAttribute(<name>);

ISimpleTypeModifiable smt=info.getModifiableSimpleType();

IModifiableSimpleValueSet svs=smt.getSVSErvices().getModifiableSimpleValueSet();

svs.put("String1","String1");

svs.put("String2","String2");

Hope this is your requirement.