cancel
Showing results for 
Search instead for 
Did you mean: 

Deletion of Context Node

Former Member
0 Kudos

Hi,

I have a requirement, where I need to create Context nodes dynamically and bind it to UI Elements. This works fine when the end user initiates the application for the first time.

When the user comes back to the same screen in the current session, I need to do the following

1. Check if the node exist and get the node.

OR

2. Delete the Context node and re-create it.

I guess the first option would be preferrable, but when I check the existence of the node, if the node does not exist, it throws a exception, which it should.

What is the best option out of the two to deal with this scenario. A sample piece of code would really help.

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Say your node is a singleton, has been added to the context root and is named "MyNode".


IWDNodeInfo nodeInfo = wdContext.getNodeInfo().getChild("MyNode");
if (nodeInfo != null)
{
  // node exists, get the node:
  IWDNode node = wdContext.getChildNode("MyNode", 0);

Armin

Former Member
0 Kudos

Hi, how are u doing the check for existence of the node?

Julio

Edited by: Julio Cesar Herrera on Nov 20, 2009 11:39 AM Correct a misunderstanding 😛

Former Member
0 Kudos

Hi,

I think it is better to get the existing context node from the context even though it will throw exception when you are looking for context node of a name which does not exist. This is because, if in case the node exists with some attributes within and some elements contained in the node then there would be no loss of data which it would have been if you directly come back to your view and delete context node and re-create a new one.

For better understaning, refer to the following document.

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/6fdae690-0201-0010-a580-d104b459cb44

For creating context node and attributes dynamically, you must have used the wdDoInit() of the interface view or the view controller. For changing context node/attribute values, you need to use inPlugFrom<OtherView> method of the view which will be called whenever we are navigating back to the same view using in bound plugs.

Regards,

Tushar Sinha