Create list of values to check for multi picklist
Set<String> typeSet = new Set<String>(); String allStr = 'All'; typeSet.add('\''+ allStr + '\''); for (Financial_Goal__c goal : Contact.FinancialGoals__r){ typeSet.add('\''+ goal.Type__c + '\''); }
Query using INCLUDES and using String.join to create string of List.
List<Content__c> typeMappings = (List<Content__c>) Database.query( contentMappingQueryFactory.setCondition('Status__c=\'Publish\' AND Id!=:featureMappingId AND (Goal_Type_Attribute__c INCLUDES(' + String.join(goalTypeList, ',')+ ') AND Age_Attribute__c INCLUDES(' + String.join(ageList, ',')+ ') AND Employment_Attribute__c IN :employementList AND Gender_Attribute__c IN :genderList AND Net_Worth_Attribute__c IN :netWorthList)').setLimit(2).toSOQL());
Use , for OR and ; for AND to match values in picklist
OR: will match for any value in picklist String.join(goalTypeList, ',') AND: will match for all the value in picklist String.join(goalTypeList, ';')
Quality posts is the crucial to be a focus for the people to pay a visit the site, that’s what this web site is providing.
Hello admin, i must say you have hi quality content here. Your blog
should go viral. You need initial traffic boost only.
How to get it? Search for; Mertiso’s tips go viral