You need to sign in to do that
Don't have an account?
selecting a Value from Multipicklist.
Hi All!,
I am trying to solve this below problem, Can any one experienced with this, help me out...
My Object Is: ContentVersion
My Filed Is : Content_Type__c (multi picklist)
Functionality is passing "type" as URL parameter, so that It will retrieve the records bases on "type".
I am trying to verify that my query is picking up content that has been tagged in two or more "Types" It seems like I may need to change my query to be "contains" rather than equals.
Can I write "Contains" or "Includes" in SOQL Like in 2nd Screen shot. I tried, it got executed but while seeing the output Error comes like : Unexpected Contains (For Contains), Invalilid "Announcemnts" (Product 'Announcements' is one of the Content_Type__c.). It throws error here while using Includes.
String query = 'Select Id, Title, LastModifiedDate, Content_Type__c, ContentDocumentId,Description,ContentSize From ContentVersion ';
if(type != null && type != '') { query += ' where Content_Type__c = \''+type+'\''; }
//Set<String> multiSelectValues = new Set<String>(); //multiSelectValues.addAll(ContentVersion.Content_Type__c.split(';')); //if(multiSelectValues.contains('Product Announcements')){ //query += ' where Content_Type__c = \''+type+'\''; //query += ' where Content_Type__c Includes (:'+' \''+type+'\')'; //query += ' where Content_Type__c contains(:%+type+%)'; //}
Can I write my SOQL with either "Contains" or "Includes". ?
should work ... - the type variable is a string - right?
All Answers
should work ... - the type variable is a string - right?
Hi Dirk,
Perfect ..!! Now my SOQL is throwing distinct records in my production Environment.
Thanks alot for your help.