Skip to Content
avatar image
Former Member

How to delete dynamically created attribute

Hi,

I am creating table dynamically according to no of columns. first time its displaying correctly, second time once i changed the no of columns its throwing error message like:

com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DynamicView.TableNode): duplicate name for attribute name0.

Everytime before creating table i tried following commands.

table.removeAllColumns();

but still i am getting error.

Help me out in this....

Regards

Suresh KB

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 29, 2006 at 01:18 PM

    First, verify if you really need to create the context structure dynamically.

    If yes, you can only delete all dynamically created context structures at once using IWDContext.reset().

    Can you give more details about the use case?

    Armin

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Suresh,

      Just an idea:

      - Create empty model node;

      - in onAction create dynamic implementation of ICMIModelClassInfo and "associate" it with your model node (see Valery`s blog /people/valery.silaev/blog/2005/09/09/common-model-interface for more information)

      - the rest is the same like you described (UI elements binding and data loading in displayRecords).

      Best regards, Maksim Rashchynski.

  • avatar image
    Former Member
    May 02, 2006 at 04:26 AM

    hi suresh

    table.removeAllColumns();

    will remove all the columns from the view.

    but when u create the context attributes they are already existing. So it is giving the duplicate context exception.

    To solve this problem, first delete all the attributes created dynamically. using below code.

    wdcontext.node<urnode>().reset(<b>False</b>).

    it will delete all the attrbutes created at runtime.

    to delete attrbutes created at designtime use.

    wdcontext.node<urnode>().reset(<b>True</b>).

    Regards

    Brahmanandam.A

    collections created at design time will be preserved. All dynamically

    added nodes and attributes are destroyed from the metadata.<p>

    Calling reset(true) is functionally equivalent to calling reset().<p>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 16, 2007 at 11:06 AM

    hello,

    another question,

    when man click the button "delete field" , the Context attribute must be removed.

    how do it?

    thx

    regards

    Yaning

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      API Documentation..

      <i>Node infos also provide a mean to dynamically add child nodes (there are different methods for unmapped, mapped and recursive nodes) or attributes (unmapped or mapped, several methods to add attributes automatically from external meta data). You cannot remove such nodes or attributes afterwards, you can only reset the whole context to its initial state via IWDContext.reset(boolean). </i>

      So instead.. delete the particular column..