cancel
Showing results for 
Search instead for 
Did you mean: 

To avoid duplicate values in DrowpDownByIndex

Former Member
0 Kudos

hi

Iam calling an RFC ,it's output is as following

column 1 column2

A 2

A 3

A 42

B 34

B 3

B 11

B 0

Iam displaying these values in two combo box. But my requirement is as following in first combobox if i select A ,only those values in column 2 which are mapped to A ie(2,3,42) should see in the combobox two.So pls help me i don't know how to do this iam a beginner in webdynprofor java.

I'll give points.......

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can loop through the node of combo box1:

List attrList = new ArrayList();

IPrivate<VIEW NAME>.I<NODE NAME>Element ele = null;

for(int i = 0;i<wdContext.node<NAME>.size();i++){

if(wdContext.node<NAME>().get<NAME>elementAt(i).get<ATTR_NAME1>().startWith("A")){

// ATTR_NAME1 is the attribute mapped to checkbox1.

// create element of another attribute which should be mapped to checkbox2.

ele = wdContext.create<NODE NAME>Element();

ele.set<ATTR NAME2>(wdContext.node<NAME>().get<NAME>elementAt(i).get<ATTR_NAME1>());

// ATTR_NAME1 is the attribute mapped to checkbox1.

attrList.add(ele);

}

}

wdContext.node<NAME>.bind(attrList);

Hope this will solve your problem.

thanks & regards,

Manoj

Answers (2)

Answers (2)

Former Member
0 Kudos

There could be several ways to do this. You can have these values in value node with attributes for say col 1 and next for col 2.

You can iterate through the value node to check if the value of fst col exists then show the corresponding attribute in 2nd combo box.

Other way u can have is to use hashmap where u can have the key as the fst col(A,B etc) and the object as comma separated values (numeris ones) for example. you can check if the key exists then show the corresponding values in the second combo box.

Hope it helps.

revert in case of queries

Former Member
0 Kudos

Hi,

To fill a drop-down list ByIndex you need a context node

Ex: A node ->Names

namevalues-> with an attribute of type string

use a supply function to add and remove items

Every time the first field changes call invalidate() on node Names.

Bind the DropDownByIndex element to the context attribute Names.namevalues.

Regards

Ayyapparaj