Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Re: How to check if a value is in the list.

$
0
0

Hi Anurag,

 

 

Thanks for your response.

 

I do not want the value to be selected before I disable the buttons.  I want the buittons for which there is no data on load of the dashboard.  After your response, I made some changes.  I am hardcoding the text of the buttons which are of known products.  Product_1 to Product_7.  I am loading DS_1 which will filter data on load of dashboard for a particular city.

 

I will have buttons for each product when the dashboard loads for a particular city, I have the button texts named as PRODUCT_1, PRODUCT_2 etc, only the products available for the city are available in DS_1.  I wanted to check whether each of these texts is available in the DS_1 data.  I am using the below based on your suggestion.

 

//create a variable str1

str1=[DS_1.getMemberList("ZPRODUCT", MemberPresentation.TEXT, MemberDisplay.TEXT, 0)];

 

//Next I provided the below query:

if(str1.indexOf("PRODUCT_1")>0)

{

  product_1_BUTTON.setEnabled(true);

}

else

{

  product_1_BUTTON.setEnabled(false);

}

 

In edit initial view of DS_1 I can clearly see PRODUCT_1 as one of the member list texts, but still this does not work.

The button is still disabled.

 

When I tried to get the index of the text that I am sure should  be there I get '-1', which means it is not found. 

TEXT_1.setText(str1.indexOf("PRODUCT_1")+"");

 

However; even if I get a product name that is not available PRODUCT_Z still the button is not enabled.  which is correct but I don't think this  is happening because  of the script.

 

What could be the reason.  Response much appreciated. Thanks again.

 

Regards,

VB


Viewing all articles
Browse latest Browse all 8695

Trending Articles