Questions tagged [aggregate]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
10
votes
2answers
8k views

What makes a field not groupable

I'm trying to use an aggregate query, but one of the fields I want to group by is not groupable (saw it in the soql error and then verified groupable=false in the metadata). It's just a number field ...
11
votes
4answers
12k views

SOQL aggregate query limit [Updated for Summer18]

I'm trying to use aggregate queries to save work and script statements. The object has a field for each month representing energy usage for that month for a building. In situations where a building ...
4
votes
2answers
5k views

How can i get the id of the max record?

Here is a situation where i need to get the last date of apppointment for a contact and i also need the id of the last appointment date. All appointments are stored in custom object and has a lookup ...
19
votes
3answers
11k views

System.QueryException: Aggregate query does not support queryMore()

I am trying to deploy around 80 Components which include Apex Class,Trigger and Visualforce Pages. But it is failing due to below exception, MyTrigger: execution of BeforeInsert caused by: System....
5
votes
2answers
462 views

SOQL Query of lookup relationship

I have an SObject called Team_Member__c It has a lookup field Manager__c pointing to Team_Member__c, so the Team_Member__c SObject is related to itself. The relationship represents a management ...
5
votes
2answers
2k views

Grouping in Visualforce Charts

I have created a visualforce charting barSeries and it renders the results that I want aside from products with values of zero for the month. The chart is a repeat business report that is meant to ...
11
votes
2answers
9k views

Can I assign Aggregate SOQL Result directly to variable?

Salesforce documentation suggests that aggregrate soql results must first be assigned to an instance of the AggregateResult class, as shown below: AggregateResult[] groupedResults = [SELECT AVG(...
5
votes
2answers
2k views

Remote Objects and Aggregate Function

Is it possible to call count() with remote objects?
2
votes
1answer
2k views

Help displaying aggregate results in footer of pageblock table

I am trying to create a Visualforce page to display a list of related records (lookup relationship) in a PageBlockTable. I would like to include a footer row that displays the sum of one of the ...
4
votes
2answers
2k views

What is the coalesce() eqivalent?

Much like this post here: SOQL: Avoid count with NULL results return 0 (zero) instead I have an instance where I am using aggregate functions like COUNT() and MAX() on a collection of Opportunities. ...
4
votes
2answers
2k views

How can you aggregate a checkbox field with SOQL?

I need to get the average completion of a task which is recorded using a checkbox field. Since that is stored as TRUE and FALSE instead of 1 and 0 it's proving a bit difficult. I would have liked to ...
3
votes
1answer
7k views

SOQL aggragated query for unique values

I have an object which captures searches made by users. It has a Searc_Phrase__c field. Each record captures one search attempt - the phrase, the use id and the date. I want to query how many times ...
1
vote
1answer
28 views

How to stop Aggregate putting multiple contact into different accounts

The following code checks to see if a contact has at least one membership record and if it does, the contacts first and last name is populated on the respective account. This trigger has been working ...
0
votes
1answer
1k views

Counting query results and displaying them in visualforce

I'm trying to count the number of each asset for an account and I'm not sure where I'm going wrong. I'm getting this error "Content cannot be displayed: Invalid field quantity for AggregateResult". ...
0
votes
1answer
99 views

Aggregated Results Unknown Property

I have the following code but the aggregate-result doesn't work. I pretty much want to return back the number of active users in the system. How do I return the Count(*) of all the active users? Class ...