You need to sign in to do that
Don't have an account?

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) ;
}
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) ;
}


Does it work if you remove the if/esle statements?