function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ramin MohammadiRamin Mohammadi 

Removing from list

Guys,

I have a list of lists that I am trying to iterate through and remove things from.
As it stands, the if/else statements are working(based on the debug statements), but the ".remove" function will not delete the entry in question.

All help is appreciated, this is the code:  

  for(integer j = 0; j < IPList.size(); j++){ 
        t = '';
        system.debug(t);
        for(Integer i = (IPList[j].Product_Releases_del__r.size()-1) ; i >= 0; i--){
            Installed_Products__c x = IPList.get(j).Product_Releases_del__r.get(i);
            system.debug(x);
            if(t == x.Product_Family__c){
                    IPList.get(j).Product_Releases_del__r.remove(i);
                    system.debug('=== go');
            }
            else{
                
                t = x.Product_Family__c;
                system.debug(t);
            }
     
        }
    
        system.debug(IPList[j].Product_Releases_del__r) ;
    }
ShashankShashank (Salesforce Developers) 
Does it work if you remove the if/esle statements?