cancel
Showing results for 
Search instead for 
Did you mean: 

insert multiple row clm data in the table

Former Member
0 Kudos

hi,

i want to create a table. the data i am getting from several inputfields n i want it to get populated in the table after pressing a button. i have set its cardinality to 1..n. so how to create a table n set its property to get it done.

thanx

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Product(value node)

|___Article(value attribute)

colour(value attribute)

cardinality 0..n

write following code on action of button.


public void onActionAddProduct(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionAddProduct(ServerEvent)
	  IProductsElement product = wdContext.createProductsElement();
 
      product.setARTICLE(wdContext.currentContextElement().getARTICLE());
      product.setCOLOR(wdContext.currentContextElement().getCOLOR());
      product.setCURRENCY("EUR");
      product.setSIZE(wdContext.currentContextElement().getSIZE());
      product.setORDER_NUMBER(wdContext.currentContextElement().getORDER_NUMBER());
      product.setPRICE(wdContext.currentContextElement().getPRICE());
      product.setSPECIAL_FEATURES(wdContext.currentContextElement().getSPECIAL_FEATURES());
      product.setTEXTILE_CATEGORY(wdContext.currentContextElement().getTEXTILE_CATEGORY());
 
      wdContext.nodeProducts().addElement(product);
    //@@end
  }

Former Member
0 Kudos

Hi,

i want to create a table. the data i am getting from several inputfields n i want it to get populated in the table after pressing a button.

create on enode for the Table and as many attribute which you want to display in the table. i.e:-

<TableNode>

<attributeName>

<attributeAge>............like that.

Now on the action of the button try to create element for the table context node, here is the sample code:-

IPrivate<viewName>.I<node>Element ele1;

ele1 = wdContext.<nodename>().create<node>Element();

ele1.set<attributeName>(inputfields value);

ele1.set<attributeName>(inputfields value);

......

and so on

wdContext.<node>().addElement(ele1);

This will create element for the Table context. And bind the Table with this context at the design time.

Hope this may help you.

Deepak

Former Member
0 Kudos

it doesnt display n create any row in the table. do i need to set any property of table? cardinality is 1..n. thanx

Former Member
0 Kudos

verify the dataSource property of Table UI.

Former Member
0 Kudos

still is does not display anything, it displays only table with no rows no columns in design. does the table visible with rows n columns in design view?

Former Member
0 Kudos

Hi,

i hope you followed the process i given in previous posts.

post your code here ..

Former Member
0 Kudos

Hi Viral,

Check The Following

1.) First of all Confirm that that are you getting Data from several inputfields.

2.) Check whether you have binded the datasource Property of the Table to the Context Node.

3.) Check whether all the TableCellEditor's Text Property is binded to the Context Attributes.

4.) Check Whether the Singleton Property of the Value Node in the Context Tab Should be Set to " True " .

With Regards,

RooP KumaR.

Former Member
0 Kudos

IPrivateTableDemoCompView.IDetailsElement element=wdContext.nodeDetails().createDetailsElement();

element.setName(wdContext.currentDetailsElement().getName());

element.setAddress(wdContext.currentDetailsElement().getAddress());

element.setCity(wdContext.currentDetailsElement().getCity());

element.setPhone(wdContext.currentDetailsElement().getPhone());

wdContext.nodeDetails().addElement(element);

Former Member
0 Kudos

hi,

with ur code i think ur using the same node for form as well as for table.

make one more node with cardinality 0...n

and assign this node to table and proceed,

IPrivateTableDemoCompView.IDetailsTableElement element=wdContext.nodeDetailsTable().createDetailsElement();

element.setName(wdContext.currentDetailsElement().getName());

element.setAddress(wdContext.currentDetailsElement().getAddress());

element.setCity(wdContext.currentDetailsElement().getCity());

element.setPhone(wdContext.currentDetailsElement().getPhone());

wdContext.nodeDetailsTable().addElement(element);

Former Member
0 Kudos

Hi Viral,

You are using the same node for Binding Data to the Table & Capturing Data from Multiple Input Fields.

Take 2 Value Nodes in the Context. One for Binding Data to the Table & another One for Capturing Data.

With Regards,

RooP KumaR.

Edited by: Roop kumar Annavarapu on Sep 11, 2008 11:10 AM

Former Member
0 Kudos

i have created another node named DetailsTable with cardinality 0..n n proceed,

IPrivateTableDemoCompView.IDetailsTableElement element=wdContext.nodeDetailsTable().createDetailsTableElement();

element.setName(wdContext.currentDetailsElement().getName());

element.setAddress(wdContext.currentDetailsElement().getAddress());

element.setCity(wdContext.currentDetailsElement().getCity());

element.setPhone(wdContext.currentDetailsElement().getPhone());

wdContext.nodeDetailsTable().addElement(element);

but it still doesnot work.

thanx..

Former Member
0 Kudos

Hi Viral,

Check Are you Populating the Data First to <Details>Node ? After that only you have to Write the Code for filling the Table.

With Regards,

Roop Kumar.

Former Member
0 Kudos

dataSource property of Table UI is bind with nodeDetailsTable ?

Former Member
0 Kudos

now its displaying data after binding, without writing any code.. but its updating the same row if i try to edit inputfield n press ok again.

so what do i need to do?

Former Member
0 Kudos

that i didnt do, but now its working aft doing that n also without writing any code. but its getting update the same row when i try to add new row by updating inputfields.

Former Member
0 Kudos

for ur code add one more statement

wdContext.nodeDetailsTable.moveNext();

Former Member
0 Kudos

then its displaying two same rows for the previously inserted record.

Former Member
0 Kudos

one time it is adding two rows or allowing duplicate rows ?

if ur problem is duplicate rows add validation.

Former Member
0 Kudos

its adding every row two times. initialy it adds row two times. if i dont write any code then its working fine but doesnt allow to add new row.

Edited by: Viral Patel on Sep 11, 2008 8:41 AM

Former Member
0 Kudos

Hi,

take another value node with cardinality 0...n and define all attributes u like to add to table.

take table ui and go to properties u see the dataSource assign this node.

write this code on the button event,

IPrivate<ur view name>View.I<Node Name>Node i<Node Name>Node = wdContext.node<Node Name>();

IPrivate<ur view name>View.I<Node Name>Element i<Node Name>Element = i<Node Name>Node.create<Node Name>Element();

i<Node Name>Element .set<Your Attribute>(wdContext.current<Your form name>.get<Your attribute>());

i<Node Name>Node.addElement(i<Node Name>Element );

i<Node Name>Node.moveNext();

Regards,

ramesh

Edited by: Ramesh Babu V on Sep 11, 2008 9:52 AM