You need to sign in to do that
Don't have an account?
Ramin Mohammadi
Loop through subquery
Guys,
I need to loop through a subquery, but am getting an "Invalid Type: Product_Releases__r" Error.
Query:
IPList = [select Name,(select Account__c, Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: AccountID];
Loop Code:
For(Account acc: IPList){
For(Product_Releases_del__r p: acc.Product_Releases_del__r){
if( p.Product_Family__c == FTemp){
acc.remove(p);
}
else {
FTemp = acc.Product_Family__c;
}
}
Thanks
I need to loop through a subquery, but am getting an "Invalid Type: Product_Releases__r" Error.
Query:
IPList = [select Name,(select Account__c, Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: AccountID];
Loop Code:
For(Account acc: IPList){
For(Product_Releases_del__r p: acc.Product_Releases_del__r){
if( p.Product_Family__c == FTemp){
acc.remove(p);
}
else {
FTemp = acc.Product_Family__c;
}
}
Thanks
Hope this helps.
For(Account acc: IPList)
{
//acc.Product_Releases_del__r will return array of acc.Product_Releases_del__c
For(Product_Releases_del__c p: acc.Product_Releases_del__r)
{
if( p.Product_Family__c == FTemp){
acc.remove(p);
}
else {
FTemp = acc.Product_Family__c;
}
}
}
Please let us know if this will help u
THanks
Amit Chaudhary
for ( Account IPList : [ select Name,(select Account__c, Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: AccountID] ) {
for ( Product_Releases_del__c p: acc.Product_Releases_del__r) {
if( p.Product_Family__c == FTemp){
acc.remove(p);
}
else {
FTemp = acc.Product_Family__c;
}
Hope it helps
Thanks
Smriti Sharan