Skip to Content
author's profile photo Former Member
Former Member

How to access a dynamic created attribute in a context node?


<i>who could help? I can't set a value for a dynamically created attribute which is bind to a table.</i>

<i>My context of the view looks as follow (is defined in NetWeaver):</i>

- Context

- Availability (Node)

- vctxService (Attribute)

- vctxServiceDesc (Attribute)

- ... (further predefined attributes)

- ... (some have to be set dynamically as follows)

<i>Then I have added attributes dynamically in the wdDoModifyView(...) - method, as follows:</i>


for (int i = 0; i < max; i++) {

// some code to dynamically create table columns


// adding attributes dynamically

IWDAttributeInfo attrInfo = wdContext.nodeAvailability().getNodeInfo(). addAttribute("vctxAvailability_" + i, "");

tv.bindText(attrInfo); // bind to TextView in table



<i>In the method onPlugFrom... I tried to set the values for the attributes "vctxAvailability_ + i" as follows:</i>

for (int i = 0; i < max; i++) {

IAvailabilityElement newAvailNodeElement = wdContext.createAvailabilityElement();

// some values will be set for the

// predefined attributes of AvailabilityNode

// newAvailNodeElement.set...( value );

// newAvailNodeElement.setVctxService( xy.getServ() );


// now the values of dynamically created and added

// attributes in AvailabilityNode will be added


newAvailNodeElement.setAttributeValue ("vctxAvailability_" + i, "value" + i);



<i>It would be great if someone could help me.

Thanks in advance.

Kind regards,


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2004 at 05:20 PM

    Hi Carsten,

    i'm not quite sure about the sequence the methods are invoked in your scenario. Maybe the onPlugFrom..() method is called before wdDoModifyView() and so you access the dynamic attributes before they are actually created.

    By the way, there's no need to add the attributes in wdDoModifyView() (binding the UI elements is something different), doing this in wdDoInit() would be much more safer in this case, since wdDoInit() is always the first method invoked when a controller is accessed for the first time.

    Hope that helps.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member


      Here is a sample code that creates context attributes dynamically and also sets values:

      //Creates a node

      IWDNodeInfo nodeInfo = wdContext.wdGetAPI().getRootNodeInfo().addChild("TestNode", null, true, true, false, true, false, true, null, null, null);

      //If you want to bind the node to a model node then the

      //second argument to the above method should be the

      //model class.

      //Creates an attribute under the node just created.

      IWDAttributeInfo testAttrib = wdContext.wdGetAPI().getRootNodeInfo().getChild("TestNode").addAttribute("testAttrib", "");

      IWDNodeElement testNode = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION).getCurrentElement();

      IWDNode testNode2 = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION);

      //Now you can bind testNode with the Model Node

      //You can also set a value to the newly created attribute

      testNode.setAttributeValue("testAttrib", new String("Value"));

      Hope this helps.


  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2004 at 10:42 AM


    Very much thanks for the help.

    One point is unclear for me. If I create dynamically a table in wdDoModifyView(...). Then create the dynamic attributes in onPlugFrom...(...). Where should I do then the binding from the attributes to the table - and how will it work if onPlugFrom...(...) will be called before wdDoModifyView(...). The table doesn't exist if onPlugFrom...(...) is called before wdDoModifyView(...).

    Is it a way to put all created nodes with the new attributes in a Vector and iterate them in wdDoModifyView(...) to bind them to the table?

    Thanks in advance,


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.