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

Problem Map.get()
Hii
i am using this list
List<Service__c> srList= [select id, Name, Customer__c,Days_Collection__c,Status__c,
Service_Start_Date__c,s.Customer__r.Grand_Parent_Account__c
from Service__c s where Status__c = 'Active' AND Days_Collection__c!=null AND Customer__c!=null];
map<id,Decimal> mapgrandParentsCounts = new map<id,Decimal>();
for(Service__c sr:srList)
{
if(mapgrandParentsCounts.containskey(sr.Customer__r.Grand_Parent_Account__c) && sr.Name!=null)
{
Decimal tCount = mapgrandParentsCounts.get(sr.Customer__r.Grand_Parent_Account__c);
tCount = tCount + finalCount;
mapgrandParentsCounts.put(sr.Customer__r.Grand_Parent_Account__c,tCount);
}
else
{
mapgrandParentsCounts.put(sr.Customer__r.Grand_Parent_Account__c,finalCount);
}
}
for(id gpAcc : mapgrandParentsCounts.keyset()) {
//here i want Name, city and address of this id
any idea
}
Refer this :
http://boards.developerforce.com/t5/Apex-Code-Development/Map-get-problem/td-p/511021
All Answers
I think the easiest way to solve this will be to collect all account IDs into a list and to add a query (with the wanted fields) on the Account table into a Map (accMap), and then to
extract it from this map with you want to display the data.
//getting the revevent account
Account a = accMap.get(gpAcc );
Hope that helps,
i have already done this
but from this m only getting account ids
but i want service object City, Address with respect to account id
give me some idea for this
Refer this :
http://boards.developerforce.com/t5/Apex-Code-Development/Map-get-problem/td-p/511021