I have a working aggregate result class with a wrapper. Have made a couple of data sets pulled from cases and campaigns to get aggregate results of participants of both by date and other fields. Mostly querying fields on contact. All are working great expect multiselect picklists. Im resigned to not using an aggregate result but actually I can seem to get any results back. I've tried using split, includes, escapes, variables and even bludgeoning it out into a list to count. Evidently not in the right combinations. I'm totally open to putting it in a class of it's own with any kind of output. Probably need a break. Any help would be amazing. here is an early version of the code, before I tried everything and nothing worked... I can get a simple list out of exec anon. Definitely when there is more than one option selected there's a ;
- which cannot see to be escaped and when I try to split it I get error messages that split is not a valid method on string...
public List<ExWrapperX> getGenerateAgeR3(){
list<ExWrapperX> r3QueryTotals = new List <ExWrapperX>();
List<AggregateResult> rRange3 =[SELECT race__, ID
FROM Contact
// use ids pulled from case and campaign- setconcurrent and prior
WHERE ID IN : setConCurrent
AND ID NOT IN : setConPrior
AND Race__c INCLUDES ('Asian;')
];
System.debug('age - # of IDs after rRange3 query runs' + rRange3.size());
//removed loop as it's long
r3QueryTotals.add(new ExWrapperX(String.valueOf(a.get('ln')), (Integer.valueOf(a.get('kidz')))));
}
return r3QueryTotals;
}
Tried things like this but cannot seem to put it together correctly
Account a = [Select AMSPICKLIST__c From account Limit 1];
String[] tmpString = a.AMSPICKLIST__c.split(';');
For(Stirng s : tmpString)
system.debug(s);
;
character in your option value, you should just useINCLUDES('Asian')
.