Example 1:
AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults)
{
System.debug('Campaign ID' + ar.get('CampaignId'));
System.debug('Average amount' + ar.get('expr0'));
}
Example 2:
AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults)
{
System.debug('Campaign ID' + ar.get('CampaignId'));
System.debug('Average amount' + ar.get('theAverage'));
}
Example 3:
AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults)
{
System.debug('Campaign ID' + ar.get('CampaignId'));
System.debug('Average amount' + ar.get.AVG());
}
Example 4:
AggregateResult[] groupedResults = [SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults)
{
System.debug('Campaign ID' + ar.get('CampaignId'));
System.debug ('Average amount' + ar.theAverage);
}
Which two of the examples above have correct System.debug statements? (Choose two.)
thneeb
1 year, 9 months agoselenamurr
1 year, 10 months agomageshrr
2 years agolevian
2 years, 1 month agonkarmi
2 years, 4 months agoOmShantiVeg
2 years, 4 months agocode_breaker_27
1 year, 2 months ago