Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 286
16 votes
Accepted

Can I assign Aggregate SOQL Result directly to variable?

avgAmount = (Decimal) [SELECT AVG(Amount)aver FROM Opportunity][0].get('aver'); Normally I would have said this was a little unsafe, since your always assuming you have one item in the result array the aggregate … However I've just tested it and even if the object has no records in it you do get an a single aggregate result. However the value of 'aver' is null. …
Andrew Fawcett's user avatar
2 votes

How can you aggregate a checkbox field with SOQL?

I was able to achieve this by creating a Formula Field to translate the Checkbox field into a Number field, then the SOQL worked as expected. For the following records... I got these results... …
Andrew Fawcett's user avatar
5 votes

Aggregate query fails when MyField__c exits in both package (NS_MyField__c) and customer org...

One of our developers Chris Peterson has a case raised with Salesforce 09290363, in it he is currently discussing with the support team if it is a bug or not. Our feeling is it is a bug and agree with …
Andrew Fawcett's user avatar