<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using Aggregate Functions</title>
	<atom:link href="http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/</link>
	<description>Authored by Scott Hemmeter of Arrowpointe Corp, this blog is written from the perspective of a Salesforce.com solution provider and contains information on Arrowpointe's AppExchange products as well as tips, findings, sample code, functionality wishes, etc.</description>
	<lastBuildDate>Mon, 26 Jul 2010 02:42:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jason Venable</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62933</link>
		<dc:creator>Jason Venable</dc:creator>
		<pubDate>Wed, 31 Mar 2010 18:10:56 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62933</guid>
		<description>@Brett Kahnke

This message only appears with IE browsers.Google &quot;disable ie mixed content warning&quot; and it should show you how to disable this warning.</description>
		<content:encoded><![CDATA[<p>@Brett Kahnke</p>
<p>This message only appears with IE browsers.Google &#8220;disable ie mixed content warning&#8221; and it should show you how to disable this warning.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Venable</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62932</link>
		<dc:creator>Jason Venable</dc:creator>
		<pubDate>Wed, 31 Mar 2010 18:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62932</guid>
		<description>Okay. I think my original statement was correct. These queries are limited to 10,000 rows. I don&#039;t know why but I swear this type of query was working earlier but now it is failing to many query rows.

AggregateResult[] groupedResults = [SELECT Account.Industry, AVG(Amount)aver FROM Opportunity group by Account.Industry];

As I originally stated this is because the database must query every row to calculate the average.</description>
		<content:encoded><![CDATA[<p>Okay. I think my original statement was correct. These queries are limited to 10,000 rows. I don&#8217;t know why but I swear this type of query was working earlier but now it is failing to many query rows.</p>
<p>AggregateResult[] groupedResults = [SELECT Account.Industry, AVG(Amount)aver FROM Opportunity group by Account.Industry];</p>
<p>As I originally stated this is because the database must query every row to calculate the average.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett Kahnke</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62832</link>
		<dc:creator>Brett Kahnke</dc:creator>
		<pubDate>Wed, 24 Feb 2010 17:52:21 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62832</guid>
		<description>Sorry, silly question.  I know why - it&#039;s caused because the google charts don&#039;t support https:  But, how do you deploy this to your users without driving them nuts?  Thanks again</description>
		<content:encoded><![CDATA[<p>Sorry, silly question.  I know why &#8211; it&#8217;s caused because the google charts don&#8217;t support https:  But, how do you deploy this to your users without driving them nuts?  Thanks again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett Kahnke</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62831</link>
		<dc:creator>Brett Kahnke</dc:creator>
		<pubDate>Wed, 24 Feb 2010 17:19:20 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62831</guid>
		<description>Working great for us.  Thanks!  Any idea why this code would cause IE to have the non-secure information pop-up every time the Campaign is viewed?</description>
		<content:encoded><![CDATA[<p>Working great for us.  Thanks!  Any idea why this code would cause IE to have the non-secure information pop-up every time the Campaign is viewed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan Callahan</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62793</link>
		<dc:creator>Evan Callahan</dc:creator>
		<pubDate>Tue, 16 Feb 2010 17:31:58 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62793</guid>
		<description>Great post.  FYI, I am working on these features in the IDE - all you have to do is open the meta...xml file and change the version to 18.0, and then you are able to work on the features there.</description>
		<content:encoded><![CDATA[<p>Great post.  FYI, I am working on these features in the IDE &#8211; all you have to do is open the meta&#8230;xml file and change the version to 18.0, and then you are able to work on the features there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Leach</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62779</link>
		<dc:creator>Mike Leach</dc:creator>
		<pubDate>Sat, 13 Feb 2010 23:22:05 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62779</guid>
		<description>Nice post. I share the pain of only being able to develop for v18 features in the browser.</description>
		<content:encoded><![CDATA[<p>Nice post. I share the pain of only being able to develop for v18 features in the browser.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wes</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62769</link>
		<dc:creator>Wes</dc:creator>
		<pubDate>Thu, 11 Feb 2010 10:05:46 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62769</guid>
		<description>Nice work Scott, these will be incredibly useful going forward.. and to some degree in making legacy code more efficient *grumble grumble*.</description>
		<content:encoded><![CDATA[<p>Nice work Scott, these will be incredibly useful going forward.. and to some degree in making legacy code more efficient *grumble grumble*.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62766</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:55:24 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62766</guid>
		<description>Actually I am wrong. Something like this:

AggregateResult[] groupedResults = [SELECT Account.Industry, AVG(Amount)aver FROM Opportunity group by Account.Industry];
for(AggregateResult a : groupedResults){
system.debug(a.get(&#039;Industry&#039;));
system.debug(a.get(&#039;aver&#039;));
}

...according to the debug log limits is only returning 1 row even though it says 152 rows where returned. I&#039;m guess the 152 is the number of Industries.

It would appear using group by is the key to controlling row limits.

Something like this will cause the too many query rows exception:

AggregateResult[] groupedResults = [SELECT AVG(Amount)aver FROM Opportunity];</description>
		<content:encoded><![CDATA[<p>Actually I am wrong. Something like this:</p>
<p>AggregateResult[] groupedResults = [SELECT Account.Industry, AVG(Amount)aver FROM Opportunity group by Account.Industry];<br />
for(AggregateResult a : groupedResults){<br />
system.debug(a.get(&#8216;Industry&#8217;));<br />
system.debug(a.get(&#8216;aver&#8217;));<br />
}</p>
<p>&#8230;according to the debug log limits is only returning 1 row even though it says 152 rows where returned. I&#8217;m guess the 152 is the number of Industries.</p>
<p>It would appear using group by is the key to controlling row limits.</p>
<p>Something like this will cause the too many query rows exception:</p>
<p>AggregateResult[] groupedResults = [SELECT AVG(Amount)aver FROM Opportunity];</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62765</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62765</guid>
		<description>Because to get the number (avg, count, sum) database must query all of the rows.

Min and Max are sort of silly as you could always get these by using order by asc / desc and limit 1.</description>
		<content:encoded><![CDATA[<p>Because to get the number (avg, count, sum) database must query all of the rows.</p>
<p>Min and Max are sort of silly as you could always get these by using order by asc / desc and limit 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hemmeter</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62764</link>
		<dc:creator>Scott Hemmeter</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:22:55 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62764</guid>
		<description>@Jason, does a lot of that go away with Spring 10 when collections have no limit?  Why would there be a 10,000 row limit on a query like this when all you are retrieving is a number?</description>
		<content:encoded><![CDATA[<p>@Jason, does a lot of that go away with Spring 10 when collections have no limit?  Why would there be a 10,000 row limit on a query like this when all you are retrieving is a number?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://sfdc.arrowpointe.com/2010/02/10/using-aggregate-functions/comment-page-1/#comment-62763</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 10 Feb 2010 18:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://sfdc.arrowpointe.com/?p=732#comment-62763</guid>
		<description>One thing to watch out for is this line: 

AggregateResult[] groupedResults = [select Status, count(Id) from CampaignMember where CampaignId = :camp.id group by status]; 

is still governed by the query row limit (ie 10000 for VF pages) and what makes this even trickier is that you cannot use the limit clause on a Aggregate query. And what makes this even more dangerous is that SOQL limit exceptions cannot be caught and handled.</description>
		<content:encoded><![CDATA[<p>One thing to watch out for is this line: </p>
<p>AggregateResult[] groupedResults = [select Status, count(Id) from CampaignMember where CampaignId = :camp.id group by status]; </p>
<p>is still governed by the query row limit (ie 10000 for VF pages) and what makes this even trickier is that you cannot use the limit clause on a Aggregate query. And what makes this even more dangerous is that SOQL limit exceptions cannot be caught and handled.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
