cancel
Showing results for 
Search instead for 
Did you mean: 

find specific item in a hierarchy

Former Member
0 Kudos

hi all,

i have a hierarchy created.i have one input field and one submit button.when i enter the an item(eg.company code) in the input field ,that particular row should be pointed.How can i do that.

regards

kukku

Accepted Solutions (1)

Accepted Solutions (1)

Yashpal
Active Contributor
0 Kudos

Hi Kukku,

make loop throug ur context node element and check it for ur input i.e company code

like

loop less than wdcontext.nodeClient().size();

check i.e if condition

wdcontext.nodeClient().getElementAt(variable of loop).getCompanyID().equals("ur entered value");

if its true than

wdcontext.setleadSelection(variable of loop);

this will solve ur problem.if any query post it

Thanks,

Yashpal

Give appropriate reward points

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

i am getting all the elements in the Catalog.can u tell me how to move to a particular node element in this hierarchy.

regards

kukku

Former Member
0 Kudos
wdContext.nodeCatalogEntries().moveTo(index)

Armin

Former Member
0 Kudos

hi,

Catalog is the .java file from vr i m getting my data for the tree hierarchy.

i am getting the row id of the given item.if i set the lead selection with that row id,i m getting array index out of bound exception.

here is the code..

for (i = 0; i < Catalog.getLength(); i++) {

if (booktitle.equalsIgnoreCase(Catalog.getTITLE(i))){

msgmgr2.reportSuccess("book id1 " + Catalog.getCATALOGID(i));

x = i;

break;

}

}

msgmgr3.reportSuccess("row id is" + x);

wdContext.nodeCatalogEntries().getCatalogEntriesElementAt(x);

wdContext.setLeadSelection(x);

Former Member
0 Kudos

You are setting the lead selection of the context root node (wdContext), therefore you get the exception.

Does the node "CatalogEntries" contain all elements from the "Catalog" collection? If not, you will also get index troubles.

Armin

Former Member
0 Kudos

hi,

i am getting the id with the following code..

for (i = 0; i < Catalog.getLength(); i++) {

if (booktitle.equalsIgnoreCase(Catalog.getTITLE(i)))

msgmgr2.reportSuccess("book id1 " + Catalog.getCATALOGID(i));

}

now if i write the code.. wdContext.nodeCatalogEntries().getElementAt(i); outside or inside the loop,i m getting array index out of bound exception.

how can i get the elemnt so that i can point to that elemnt in the hierarchy.

regards

kukku

Yashpal
Active Contributor
0 Kudos

sorry for small mistake...

u have to use getNodenameElementAt(i) method......

if ur node name is "Catalog"

then

getCatalogElementAt(i) check it by pressing ctrl+space

Former Member
0 Kudos

HI,

By the by whats Catalog here in he code u have mentioned..

You have to get nodeX.size()..and loop throught the entries in that node.

I guess u have used something else..(length of some string.)

Regards

Bharathwaj