cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdownbyindex string comparision

Former Member
0 Kudos

Hi All,

I have a dropdown with 15 states are listed and those are coming from the backend while executing the RFC. I have 5 states hard coded and check if this retrived dropdown state is equals to hard coded state value with AP,MH,UP,MP,MO. if the retriedved value matches hard coded state value then i have to fire an event, if not then no event required.

I will get the currrnt state as:

String stateValue = wdContext.currentContextElement.getState();

stateValue.equals()............................?

this retrived state value needs to comapre with hard coded 5 states say exampel: AP,MH,UP,MP,MO. if any one matches i have to raise an event or else not.

Please advice

Peter.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use the below mentioned code:

String strStates []={"AP","MH","UP","MP","MO"};

for (int i=0;i<strStates.length();i++){

if(stateValue.equalsIgnoreCase(strStates<i>)&&! stateValue.equalsgnoreCase(retrievedValue)))

{

// fire an event

}

}

Hope this helps you.If not please throw some more light on second requirement.

regards,

amit bagati

Former Member
0 Kudos

Hi,

if(stateValue.equals("AP") || stateValue.equals("MH") || stateValue.equals("UP") || stateValue.equals("MP") || stateValue.equals("MO"))

{

// fire an event.

}

Regards,

Murtuza

Former Member
0 Kudos

Thanks for the quick reply.

I forgot to mention this. Say if the retrived value is CH and if the user changed to again CH(not required to do select the same stae again but some time users do) and when the click on save that time also should not fire an event. This CH is not listed in hard coded states.

Thanks

Peter

Former Member
0 Kudos

Hi Peter,

I am a bit confused with your requirement:

Did you mean that if the user intially selected CH and then clicked on it again to deselect it? If yes, then when you loop through the node to find the multiselected value for that index it won't be set as it was deselected. If your requirement is different then let me know.

Regards,

Murtuza

Former Member
0 Kudos

The requirement is if the user selects a state which is equals to hard coded states or if the user slects the same state which he already belongs to, in both cases i do not want to raise an event...

Former Member
0 Kudos

Hi Peter,

Ok I got your requirement. Here is the condition

if(stateValue.equals("AP") || stateValue.equals("MH") || stateValue.equals("UP") || stateValue.equals("MP") || stateValue.equals("MO") && !stateValue.equals(<retrieved value>))

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza ,

Thanks for the reply. The secound one is not working. Some how not working for existing one.

&& !stateValue.equals(<retrieved value>)

Please advice.