You need to sign in to do that
Don't have an account?
Using Contains within the multiselect Picklist Values
Hi..
Am working on search scenario with multiselect picklists...
For example if the field has values like A,B,C,D..... and the records 1 and 2 contains 1) Open,test 2) New,test within them
During Search if I Give Open,test or New,test the Recordds are getting searched correctly.....
But the requirement is, i need to display the record 1 if i give only Open for the field instead of Open,test ...i need to work with contains functionality...
While trying to use CONTAINS(Disability__c,'Open','test','New') am getting an error as unexpected token: ','
The Query that i used is :
orgselected = [select id,name,Organisation_Name__c,Disability__c,County__c,Age_of_Clients_Served__c,Type_of_Service__c from Organisation__c
where (CONTAINS(Disability__c,'Open','test','New'))
or
(name=:userinput.name and Disability__c =:userinput.Disability__c and County__c=:userinput.County__c and Type_of_Service__c =:userinput.Type_of_Service__c and Age_of_Clients_Served__c=:userinput.Age_of_Clients_Served__c)
or
(name=:userinput.name or Disability__c =:userinput.Disability__c or County__c=:userinput.County__c or Type_of_Service__c =:userinput.Type_of_Service__c or Age_of_Clients_Served__c=:userinput.Age_of_Clients_Served__c)];
Hi,
Update your query with the following changes and try to run and let me know the results.
WHERE Disability__c includes ('Open','test','New')
Regards,
Sridhar Bonagiri
Hi,
Your query should be,
[select Insurance_Plans__c from account where Insurance_Plans__c includes ('AETNA','AIG','test')];
"contains" cannot be used in queries. To filter multiselect picklists you would need to use "Includes".
Thanks
Thanks for your reply...
I even tried that...using Disability__c includes ('Open','test','New')
but the issue is...if i have 'Test' in only one record and try to search that record..then am getting the display of all the records which contains 'Open' and 'New' also...i need to filter that according to the given userinput...
Thanks in Advance...
Hi,
Yes you will get all the records because you are including three values in this query, so it is getting all the records. If you want to get only one type then your query like this
Disability__c includes ('test')
Regards,
Sridhar Bonagiri