cancel
Showing results for 
Search instead for 
Did you mean: 

Removing elements from node

Former Member
0 Kudos

Hello togehter,

I have implement the following code:

ResultSet resultSet;

resultSet = statement.executeQuery("select NAME from DNPERSO where COST like'" + InputFildKostStelle "%' or SNAME like'" InputFildName+"%'");

while (resultSet.next()){

ISelectionPersonsElement selection = wdContext.createSelectionPersonsElement();

selection.setPersons(resultSet.getString(1));

wdContext.nodeSelectionPersons().addElement(selection);

}

I use this for a search-funktion and it works fine.

My problem is now that I want to write an method to remove all the added elements of the "SelectionPersons Node".

Can anybody help me?

Patrick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Patrick,

Try this:

for(int counter=(wdContext.nodeSelectionPersons().size-1);counter>=0;counter--) {

wdContext.nodeSelectionPersons().removeElement(wdContext.nodeSelectionPersons().getElementAt(counter));

}

Thanks and regards

RK

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello Patrick,

You can remove the elements from the node in the following two ways.One way is to invalidate the node and the other way is to remove the elements using the

removeElement()

method of the node.

Examples:

First method:


wdContext.nodeSelectionPersons().invalidate

This will work well for your Value Nodes. However, for model nodes just bind suitable structure to the node and bind the instance of child node to the suitable parent nodes.

Second Method:

for ( int idx = ( wdContext.nodeSelectionPersons().size - 1 ); idx >= 0; idx-- )
	{
		wdContext.nodeSelectionPersons
().removeElement(wdContext.nodeSelectionPersons().getSelectionPersonsElementAt(idx));
	}

Bala

Former Member
0 Kudos

It works,

thank you very much.

Former Member
0 Kudos

Hi,

If u want to remove all the element just write this code:

wdContext.node<name>().invalidate();

this will invalidate all the elements of the node.

If u want to remove a specific element from the node there is a method like remove():

wdContext.node<name>().removeElement();

Regards,

Piyush.