+ Start a Discussion

"Does Not Contain" operator help

Our app provides query functionality against the Lead and Contact objects, similar to the "Create a new view" mechanism in salesforce.com. We are looking for a way to include an operator for "does not contain" but it appears that the API documentation does not provide information to make this happen.

Does anyone know of a way to handle this, short of pulling all data first and then excluding everyone that falls into the "contains" collection?
Assuming you're using SOQL to query the records, try ... not like ... as in:
    Select Id, LastName from User where not LastName like '%a%'
which returns all the users that do not contain 'a'.
Thanks Scot, this worked. Our developer just had make a minor adjustment and all is good - appreciate the help.
Anand SinghAnand Singh

Hi Scot,


The SOQL does not work if we add additional criteria in the statement as follows:


Select Id, LastName from User where  not LastName like '%a%' and city != null


Select Id, LastName from User where city != null and  not LastName like '%a%' 


It seems like it Is not supported in SFDC.