• satish dixit
  • 0 Points
  • Member since 2015

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

I need to be able to convert the values in a set into a comma separated list so that I can use it in a SOQL query.

Here is the code:


        List<GroupMember> getGroups = [SELECT group.name FROM GroupMember WHERE UserOrGroupId =:someID];
        system.debug('after getGroups' +getGroups);

	for (integer i=0;i<getGroups.size();i++){	
			system.debug('Group Name ='+getGroups[i].group.name);
			if (OTHERCLASS.MAP_BY_GROUPNAME.containsKey(getGroups[i].group.name)==true){
        system.debug('college list after adding to set'+collegeList);
        // add all to array
        //CollegeListArr.addAll(collegeList);  // this does not work
        system.debug('after adding to array');
        for(integer y=0;y<collegeList.size();y++){
        if(y>0) collegeListArr +=',';  
        collegeListArr += collegeList[y].id; // this does not work

If I try to addall, I get an error on the Visual Force page:  unexpected token: '{College Name}'  

If I try the second method, I get 'Illegal Assignment from String to Set<String>'