Skip to main content

Hi All,

 

I want to hide particular drop down  value(Scrap) once the from part need checkbox is unchecked in mobile.

 

Once I click on the from part need checkbox I should be able to hide the Scarp value only from the dropdown not the (Installed and Transfer To Vanstock values)

 

Below is my code but its not working as expected kindly help.

 

var IsChecked = getControlValue("custom","from_part_needs");
if (IsChecked == 'N') 
{
   var conSump = stringFormat("SELECT description, code_value FROM global_code_table WHERE code_name = 'ELUX_CONSUMPTION_TYPES' AND code_value != 'Scrap'");
   populateListFromQuery('part_usage','user_def16', conSump, false);
}
else
{
    var conSump = stringFormat("SELECT description,code_value FROM global_code_table WHERE code_name = 'ELUX_CONSUMPTION_TYPES'");
    populateListFromQuery('part_usage','user_def16', conSump, true);
}

 

 

Regards,

Pinmaya

 

Hi ​@Pinmaya Kumar Singh 

SQLite is case-sensitive for string comparisons by default. If the code_value can have different capitalisations (e.g., "scrap", "SCRAP", "Scrap"), you might want to use LOWER() to ensure you are comparing it case-insensitively:

For example

...
LOWER(code_value) != 'scrap'
...

Also, change your whole query to lowercase.

SELECT → select; FROM → from; etc.

Make sure to assign the script on the after value change event of custom.from_part_needs field

 

Cheers!


 

@Shneor Cheshin 

 

var IsChecked = getControlValue("custom","from_part_needs");
if (IsChecked == 'N') 
{
   var conSump = stringFormat("select description, code_value FROM global_code_table WHERE code_name = 'ELUX_CONSUMPTION_TYPES' AND code_value != 'scrap'");
   populateListFromQuery('part_usage','user_def16', conSump, false);
}
else
{
    var conSump = stringFormat("select description,code_value FROM global_code_table WHERE code_name = 'ELUX_CONSUMPTION_TYPES'");
    populateListFromQuery('part_usage','user_def16', conSump, true);
    
}

 

 

The script is working but the thing is I am not able to hide the dropdown value scrap when I uncheck the from part need field. Its there in the dropdown while we open, I want it should completely not be seen from drop down when we uncheck the from part need checkbox .

 

 

Thanks,


Reply