cancel
Showing results for 
Search instead for 
Did you mean: 

How to add elements to value node at run time

Former Member
0 Kudos

I am totaly new to webdynpro, kindly help.

I have a value node "A" and corresponding value attribute say "b", I would like to add elements to "b" at run time like "10,20,30,40" , and wants to bind these elements to table column.

Thx

Manoj

Accepted Solutions (1)

Accepted Solutions (1)

arun_srinivasan
Contributor
0 Kudos

hi

check out this

context

|

!__valuenode------valueattt (int)

|

|

|

|

|

|---userinputvalueattribute (int) (bind it to inout field for getting values from user)

IPrivate<Viewname>.I<valuenode>Element x=wdContext.node<valuenode>().create<valuenode>Element();

wdContext.nodeG<valuenode>().addElement(x);

int val=wdContext.currentContextElement().get<userinputvalueattribute>();

x.setvalueattr(val);

hope this helps,

regards,

Arun

Former Member
0 Kudos

Thx but how can i bind these elements to a table column.

I have table which is binded with a RFC output and i want to add one extra column to it and bind these value to that column.

When i use A.B in text properties of that column's text view i m getting same value in all rows.

my code is as follows.

IPrivateResults.IANode node =wdContext.nodeA();

IPrivateResults.IAElement elmt =null;

for(int i=0;i<5;i++)

{

elmt = wdContext.createAElement();

elmt.setB(10+i*10);

node.addElement(elmt);

}

Note : But when i am using a seprate table with-out binding with RFC output , i am getting correct values in all rows.

Former Member
0 Kudos

Make sure that singleton=false for node A.

Let "Data" be the table data source node (parent node of A). Then you can create an element of node A for table row at index i like this:

IDataElement row = wdContext.nodeData().getDataElementAt(i);
IAElement a = row.nodeA().createAndAddAElement();
a.setB(10*(i+1));

Armin

Former Member
0 Kudos

thx but i am getting an error on 2nd line;

"createAndAddAElement()methos is undefined"

Former Member
0 Kudos

hai,

IprivateXXXView ele=wdContext.createAElement();

use above code

regards,

Former Member
0 Kudos

node.createAndAdd<Node>Element() has been introduced in newer releases as a shortcut for

I<Node>Element e = node.create<Node>Element();
node.addElement(e);

Armin

Former Member
0 Kudos

Hi Armin,

Thanks a lot, My problem has been solved now.

Answers (1)

Answers (1)

Former Member
0 Kudos

(I assume you mean adding elements with int values to node A and B be an integer attribute.)

wdDoInit():

for (int i = 10; i <= 40; i += 10)
{
  IAElement a = wdContext.nodeA().createAndAddAElement();
  a.setB(i);
}

At design time, bind some suitable property of the table cell editor of that column (e.g. TextView.text, InputField.value) to the context attribute "B".

Armin