cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownListbyKey filtering

Former Member
0 Kudos

Hi,

My objective is to select a value from a dropdownlistbykey (DDL1) and by doing so it loads some data to another dropdownlistbykey (DDL2).

The problem is that if data is loaded to DDL2 when i make another select on DDL1 the data loaded to DDL2 is the correct and also the previous.

My code is:

ZKKC_Example_Input input = new ZKKC_Example_Input();

wdContext.nodeExample().bind(input);

wdContext.nodeExample().currentExampleElement().modelObject().execute();

IWDAttributeInfo ainfo = wdContext.nodeExample().getNodeInfo().getAttribute("activitieId");

ISimpleTypeModifiable st = info.getModifiableSimpleType();

IModifiableSimpleValueSet vs = st.getSVServices().getModifiableSimpleValueSet();

for(int i=0; i<wdContext.nodeIt_Activitiesbyproject().size(); i++){

example_el = wdContext.nodeExample().getExampletElementAt(i);

if(example_el.getId().equals(filter))

vs.put(example_el.getID(),example_el.getDesc());

}

thanks for any help.

Pedro Barbosa

Accepted Solutions (1)

Accepted Solutions (1)

sridhar_k2
Active Contributor
0 Kudos

Hi,

If you want to load Data on DDL1 Selection to DDL2.

Then create a Action and assign it to the DDL1 on Selection Property. Write your logic, in that method to populate second drop down list.

If yo want to keep your Previous values also in DDL2, then

do these below steps in global or (init), hopefully it works for you.


IWDAttributeInfo ainfo = wdContext.nodeExample().getNodeInfo().getAttribute("activitieId");
ISimpleTypeModifiable st = info.getModifiableSimpleType();
IModifiableSimpleValueSet vs = st.getSVServices().getModifiableSimpleValueSet();

For More information go thru the link.

If this is not ur solution, please explain your question in detail.

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

The code i displayed was from the method called on DDL1 selection. The way your saying is to maintain the previous values and that's my problem.

The way my code is working it also keeps the previous values But what i want is to remove the previous data.

I've tried invalidating the node, removing by hand all elements and then made sure the node was empty but after the loop:

for(int i=0; i<wdContext.nodeIt_Activitiesbyproject().size(); i++){

example_el = wdContext.nodeExample().getExampletElementAt(i);

if(example_el.getId().equals(filter))

vs.put(example_el.getID(),example_el.getDesc());

}

all data gets displayed.

I also checked the if statement and is getting true only a couple of times (like it's supposed).

So how can I filter the data?

thanks

Pedro Barbosa

sridhar_k2
Active Contributor
0 Kudos

Hi,

If you want to remove previous data, clear as vs.clear() and invalidate the node.

But before clearing the ValueSet(VS), ensure it is not null.

if(vs.size()!= 0){

vs.clear();

}

In the same way, the node also.

Regards,

Sridhar

Former Member
0 Kudos

Excellent that solved my problem

Many thanks Sridhar

Pedro Barbosa

Answers (0)