cancel
Showing results for 
Search instead for 
Did you mean: 

How to read table rows fields into value attribute.

Former Member
0 Kudos

Dear Experts,

In my webdynpro application I am recieving a table from my Model, I have to read table rows fields and set them into my value attributes.

Request you to please suggest, and provide some code examples.

Warm Regards,

Upendra Agrawal

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Upendra,

Please go through this link:

Please note that there is method provided by the WDCopyService however i guessin this case that will not work since you want to transfer the model node data to value node. So you would have to iterate over the model node and set the values of the attributes in the value node.

Its similar requirement.

Thanks nad Regards,

Pravesh

Former Member
0 Kudos

My requirement is not to read the full table I have to just read a single line from the table and assign the values of that rows to my value attributes not value node, I know the index from which I have to read.

Please suggest.

Warm Regards

Former Member
0 Kudos

Hi,

If you now the index use the following code



//Node used is "Employee"
// replace x with index
IEmployeesElement empElement = wdContext.nodeEmployees().getEmployeesElementAt(x);

Regards

Ayyapparaj

Former Member
0 Kudos

hi

catch the size of the table .

set the for loop

int i=wdcontext.TableName.size();

leadSelection = wdcontext.node<NOdename>.getLeadSelection();

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

{

if(wdcontext.<nodeNOdeName>.isSelected(i) || leadSelection==i)

{

fetch the data from the table using the index .

String abc = wdcontext.node<Table Name>.getElementNameatindex{}.get<element>;

you can then store this values in the value attribute you need.

}

the above code will help you single row selection . and if the user wants multi selection simply change the if condition as if(wdcontext.<nodeNOdeName>.ismutliSelected(i) )

or

if you want both then use write both if conditions .

murali

Edited by: murali krishna reddy on Mar 23, 2009 11:54 AM

Former Member
0 Kudos

Hi,

Like Ayyapparaj KV suggested, I'd use the same piece of code;


IEmployeesElement employeesElement = wdContext.nodeEmployees().getEmployeesElementAt(x);
IEmployeesFormElement employeesFormElement wdContext.nodeEmployeesForm().currentSelection();
WDCopyService.copyElements(employeesElement, employeesFormElement );

I'm guessing here that you want to do some sort of Editable Form, which is kinda common. I'd use 1.1 in the Form node. Just remember, you need the same Value Attribute Name / Type in order to use the Copy.

Regards,

Daniel

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ..

you have to use code like

target cardinality should be---0:N...

WDCopyService.copyElements(source,target)

thanks

jati

Former Member
0 Kudos

Hi,

int size = wdContext.node<name>().size();

int leadSelection = wdContext.node<name>.getLeadSelection;

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

{

if (wdContext.node<name>().isMultiSelected(i) || leadSelected == i)

{

I<node name>Element ele = wdContext.node<name>().get<Attribute>ElementAt(i);

// now get the attributes of the element ele and set it to the desired node element.

}

}

hope it helps you meet your requirement,

Jithin.

Former Member
0 Kudos

Hi,

Please go through this

Regards

Ayyapparaj

Former Member
0 Kudos

Thanks for your quick reply,

I use that code but got the following exeption java.lang.IndexOutOfBoundsException: Index: 0 .

Please Suggest.

Warm Regards

Upendra