+ Start a Discussion
Sindhu NagabhushanSindhu Nagabhushan 

Get induvidual field values from map

map<id,aggregateresult> accmap=new map<id,aggregateresult>([select account__r.id,avg(nps__c)np,avg(Average_Score__c)avs from feedback__c where createddate=this_quarter and account__c=:accex group by account__r.id]);

This is my query.
I want to read the value of avg(nps__c) for a particular account and store that value in a new field.
How do i refer to that field?
I tried something like ar.np  but it does not work

Thanks in advance
accmap.get(accountid).get('expr0') or  accmap.get(accountid).get('np') ... You should pass the accountid to get the respective aggregated result.