cancel
Showing results for 
Search instead for 
Did you mean: 

Adding fields at runtime

Former Member
0 Kudos

Hello,

I have created a webdynpro application in which I want to add a series of fields in one row on click of a button everytime the user clicks on the button....how can I implement this as i am able to add one row of fields but when the user clicks on the button again...it gives a duplicate Exception.....

Any help would be highly appreciated.

Regards,

Anil

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You can't create two attributes with the same name in the same node. I had to do same similar and I solved using a name + number increment for each attribute.

In first place I create attribute "name1", and then "name2"... "name3"...

IWDAttributeInfo _attribute = _context.getNodeInfo().addAttribute(name + i,"ddic:com.sap.dictionary.string");

Edited by: Sebastian Celestino on Apr 6, 2009 9:19 PM

Former Member
0 Kudos

Thanks ...now I am able to create new rows with a counter with the labels......now for the inputfields how do I set the value property to context value attribute at runtime each time ......?

Looking forward to your reply.

Regards,

Anil

Former Member
0 Kudos

What is the use-case? Do you really need to create context attributes at runtime?

Armin

Former Member
0 Kudos

The same apply for inputs, each name must be unique (also use name + i).

1) Create attribute (name + some counter)

2) Create input (name + same counter)

3) Assing attribute to Input with binding:

IWDInputField input = view.createElement(......);

Input.bindValue(attributeInfo);

Former Member
0 Kudos

Thanks again for the help....i was able to create context attributes at runtime.....but those value attributes need to be mapped to context attributes in the Component Controller like the other inputfields which are mapped at designtime....how can i achieve this...?

Regards,

Anil

Former Member
Former Member
0 Kudos

Armin,

Thanks for the reply....I read the link ...now with the first method of mapping do I need to create mapped and origin node in the component and the view controller....or how do I map the context value attribute created at runtime in the View controller to a attribute in the component controller...and access it in the Implementation tab of the Component Controller using :

wdcontext.currentcontextelement.get<attribute> method....

Looking forward to your reply.

Regards,

Anil