The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
1answer
21 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 ...
5
votes
2answers
209 views

How to sort Wrapper class?

Am working with Aggregation on an object and i have specified count field in Order By Clause. Am loading aggregate results into wrapper class. Here am not getting the values in specified order. In ...
0
votes
1answer
36 views

Aggregate query does not support queryMore()

I have a requirement to send mass emails to certain Users of current day created records daily. I am unable to do that with below code. Getting error : Aggregate query does not support queryMore() ...
1
vote
1answer
196 views

Getting error “System.LimitException: Too many query rows: 50001” what i do in this case.

i tried below resolutions but no any worked... REsolution: If your controller does not have any DML operation than you can easily solve above two salesforce governer limits using the attribute ...
8
votes
1answer
91 views

Group by Rollup: Visualforce Remoting Exception: Too many query rows: 1000001

I have 557,029 Foo objects in my org. I want to count how many of each kind of picklist value there are within these: Type 1 - 100,000 Type 2 - 60,000 Type 3 - 40,000 Type N - N I thought I could ...
3
votes
3answers
102 views

Using Aggregate SOQL With Large Amounts of Data (> 500k records)

I am facing a issue about aggregate soql. My basic data object more than 500,000 record. But, i want to aggregate this object data. When i execute following data, SFDC will report the error for me. ...
2
votes
1answer
88 views

Grouped Query Cannot Use Child Relationship in Remote Action Apex Class

I am trying to count the number of account names that occur in my soql statement. Ultimately I have a map that shows all of the accounts near a technician and I want to show the number (count) of ...
2
votes
2answers
54 views

SOQL, how to return highly organized data

This may be a long shot, so bear with me. I have a query that returns a list of catagores (text strings) and a count of the number of times they occur: Order Request,7842 Request,3976 Other,3247 ... ...
2
votes
1answer
86 views

SOQL Query to count only Accounts with Opps in both this year and last year?

So rather than create an Apex class, run multiple queries then write some code to figure out the answer, I thought I'd take a stab at writing a complex query that would get me the answer I'm looking ...
3
votes
2answers
388 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 ...
0
votes
1answer
100 views

Cross-tabular Report based on GROUP BY CUBE Result

Based on Salesforce Documentation here , we may create cross-tabular report from the query result. I've managed to create the class so far to show the aggregate result. Apex Class public class ...
3
votes
1answer
208 views

Most efficient way to transform AggregateResults to String, Object Maps

Question: What is the most efficient way to transform aggregate results to string object maps? Constraints: The keys of the aggregated results are unknown. The transformation has to be performed as ...
2
votes
3answers
274 views

Issue processing data from aggregate result query

I have a master-detail relation ship where I am updating the parent (lets call it Parent__c) based on its child records aggregated values (lets call the child, Child__c). The child has a relationship ...
1
vote
1answer
220 views

Help with Aggregate Result in Batch Apex

I received some help with this on the Salesforce forums but I can't get over the hump and get it working. The code below saves fine and I'm able to schedule it and it runs through all of the batches. ...
0
votes
1answer
103 views

Problem with AggregateResult

My Rolluputility: public class RollUpSummaryUtility { //the following class will be used to house the field names //and desired operations public class fieldDefinition { public String operation ...
0
votes
1answer
95 views

Better SOQL Query or Ability to Parse Results by Field

I have two objects: OBJECTA ID Description Cost Price SKU OBJECTB ID Qty SKU Essentially, the SQL version of my query would be: SELECT A.Description, A.Cost, A.Price, A.SKU, SUM(B.Qty) FROM A ...
1
vote
1answer
82 views

AggregateResult Count help

Sorry to bother you on a Saturday, but i need some help This is a two part question, so please be patient .I have created a fieldset on the account object called “HistoryTracking”. 1) I would like ...
-1
votes
1answer
125 views

Soql using MAX query [closed]

We are querying max value among certain field values of same data type from an object. we cant form perfect query . could anyone help to get perfect query.
3
votes
2answers
288 views

Remote Objects and Aggregate Function

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

AggregateResult for a multi-select picklist

I am doing an AggregateResult SOQl query on different picklists on a Contact. List<AggregateResult> results = [select LeadSource, COUNT(id)cnt from Contact where LeadSource != null group by ...
2
votes
2answers
318 views

want to achieve rollup summary(SUM) using Aggregate functionss

Compile Error: Expression must be a list type: SOBJECT:AggregateResult at line 7 column 36 (this is line no7:manu.Total_Cost__c = Decimal.valueOf(ar[0].get('total'));) trigger rollupfldsonManuf on ...
8
votes
2answers
971 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: ...
0
votes
3answers
947 views

how to use logic with aggregate result

here i created one code which will retrieve record from "Account" object and create records in "abc" object based on selected fields. i used "AggregateResult" to add numbers with current year and ...
4
votes
1answer
291 views

activity aggregate relationships only allow security evaluation for non-admin users when a single parent record is evaluated

I am getting the following error when I run a Salesforce SOQL query with a standard account. Query: SELECT ( SELECT Id, Subject FROM OpenActivities ORDER BY ActivityDate ASC , LastModifiedDate DESC ...
1
vote
0answers
56 views

Aggregating Results: Not grouping properly

I have a query onto the OpportunityLineItem table. AggregateResult[] OppLineItemsPlays = [select OpportunityId, PricebookEntry.Product2.Play__c, COUNT(id) ...
2
votes
1answer
116 views

Aggregate SOQL with more than one 'group by'

I am using an aggregate SOQL query with more than one 'group by' I'm writing a class that fires on insert/update of a trigger on the OpportunityLineItem. This looks at a picklist field (Play__c) on ...
2
votes
2answers
579 views

Number of counts

I have one student object from that i am displaying values in visualforce page but i want to display number of males and females in that visualforce page i am not getting count of gender i am using ...
6
votes
1answer
552 views

Display the related aggregated value on a VF page

We have a custom VF page that we use in our Org for time entry, and on that page employees select a project, iteration, and enter their time for that week. Note: some employees might be working on ...
6
votes
3answers
3k views

How to use Count() in SOQL

I have a custom object. This custom object has a field Cabin_Type__c, which has values of Twin and Luxury. There is another field Deck_Type__c which is just the number of the deck such as 1,2,3,etc. ...
6
votes
1answer
1k views

Reference fields on parent object in aggregate query

I am trying to run a group by query in Apex where I am grouping by a field on a lookup object. For example: SELECT Account.Type, count(Id)FROM Opportunity GROUP BY Account.Type I can run this from ...
9
votes
2answers
2k 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 ...
3
votes
0answers
183 views

Echoing the Counts of each record through PHP using SOQL and GROUP BY

To start, this is the query: $query = "SELECT LeadSource, COUNT(id) Total FROM Lead WHERE CreatedDate > 2013-08-26T00:00:00Z AND CreatedDate < ...
1
vote
2answers
93 views

Aggregate information from multiple contacts into an account

is it possible to create a custom object which will take information from all contacts under an account and aggregate information into that account record? Here's what i'm trying to do specifically... ...
4
votes
1answer
232 views

Efficient way to perform grouping without using aggregate SOQL queries

I have an aggregate query that groups my custom object records by 4-5 fields and then returns a sum of currency fields in each grouping. I have multicurrency enabled so this sum of the currency field ...
2
votes
1answer
1k 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 ...
5
votes
1answer
185 views

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

This is really a strange bug. Inside my managed package I have a NAMESPACE_CustomObject__c with a NAMESPACE_CustomField__c. In one of my packaged classes I have an Aggregate Query String soql = ...
3
votes
1answer
1k views

Too many SOQL queries: 101 in apex class. How to count results?

List<tempcon1> listoftemp; CheckContactController chk = new CheckContactController(); public List<tempcon1> getconValues() { listoftemp = new List<tempcon1>(); for ...
4
votes
3answers
3k views

SOQL aggregate query limit

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 ...
3
votes
2answers
873 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 ...
1
vote
2answers
1k 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 ...
3
votes
4answers
2k views

Non-selective query against large object type in trigger

The Alert__c object has a Rule ID field, which is just text, and a lookup to the Master__c object. I have a trigger on Alert__c, which when runs after insert, update or delete. It collects the Master ...