You need to sign in to do that
Don't have an account?
NishaC
Problem in Map
hii
i have a problem with mapping
i am using map<id,Decimal> mapgrandParentsCounts = new map<id,Decimal>()
for SERVICE__c object
when using for loop
i want to get all the values of service object for that ID
for(id gpAcc : mapgrandParentsCounts.keyset()) {
}
but here i am getting only the decimal value
i want service NAME, CITY,ADDRESS from this for loop
any HELP ??
Is the ID in the map is for SERVICE__c.
however your map contain only decimal value for each ID so this is what you get.
maybe your map should be:
Map<ID, SERVICE__c) servID_servObj_map=new Map<ID, SERIVEC__C>();
and in the loop:
for(id gpAcc : mapgrandParentsCounts.keyset()) {
servID_servObj_map.get(gpAcc).NAME;
servID_servObj_map.get(gpAcc).CITY;
servID_servObj_map.get(gpAcc).ADDRESS ;
}
this map is in for loop of service object
for(Service__c srobj: servicelist){
if(mapgrandParentsCounts.containskey(sr.Customer__r.Grand_Parent_Account__c){
}
}
it is showing the correct result but now i want that when i use for loop of this map
then i want to show name,city and address of this
for(id gpAcc : mapgrandParentsCounts.keyset()) {
how can i get name,city from this map
any idea?
It doesn't contain NAME/CITY/ADDRESS, so you can't get them from the map.
You should create other/another map that contain ID-->Object as I wrote in the previous message