-
Notifications
You must be signed in to change notification settings - Fork 0
The Soql.AggregateResult Class
Jason Siders edited this page Jul 4, 2025
·
5 revisions
This class decorates a Schema.AggregateResult, which cannot be mocked otherwise. Objects of this type are returned by the Soql class's aggregateQuery method, and can be mocked via the MockSoql.AggregateResult class.
Soql.Aggregation count = new Soql.Aggregation(Soql.Function.COUNT, User.Id);
List<Soql.AggregateResult> results = DatabaseLayer.Soql.newQuery(User.SObjectType)
?.addSelect(count)
?.toSoql()
?.aggregateQuery();
Soql.AggregateResult firstResult = results?.get(0);
Integer numUsers = firstResult?.get('expr0');Calls the underlying Schema.AggregateResult object's get method. The key parameter refers to the field alias if one is assigned, or the parameter's index in query preceded by the expr if one is not assigned (x, expr0).
Object get(String key)
- Generating Test Records
- Dml
- Soql
- Cmdt
- Duplicates
- Plugins
- DatabaseLayer
- Dml
- MockDml
- MockRecord
- Cmdt
- MockCmdt
- Duplicates
- MockDuplicates
- MockSoql
-
Soql
- Soql.AggregateResult
- Soql.Aggregation
- Soql.Binder
- Soql.Builder
- Soql.Condition
- Soql.ConditionalLogic
- Soql.Criteria
- Soql.Cursor
- Soql.Function
- Soql.InnerQuery
- Soql.InvalidParameterValueException
- Soql.LogicType
- Soql.NullOrder
- Soql.Operation
- Soql.Operator
- Soql.ParentField
- Soql.PreAndPostProcessor
- Soql.QueryLocator
- Soql.Request
- Soql.Scope
- Soql.Selectable
- Soql.SortDirection
- Soql.SortOrder
- Soql.Subquery
- Soql.TypeOf
- Soql.Usage
- Soql.WhenClause