v3.2.3
25-April-2024
New
groupBy(String relationshipName, SObjectField field)
groupByRollup(String relationshipName, SObjectField field)
groupByCube(String relationshipName, SObjectField field)
Refactoring
- Iterable for
SubQuery with(Iterable<SObjectField> fields)
- Iterable for
Filter containsSome(Iterable<String> values)
- Code refactoring
groupBy
related
Thanks to @jessewheeler 's help, we have a groupBy
related.
Signature
Queryable groupBy(String relationshipName, SObjectField field)
Example
SELECT COUNT(Name) count
FROM OpportunityLineItem
GROUP BY OpportunityLineItem.Opportunity.Account.Id
SOQL.of(OpportunityLineItem.SObjectType)
.count(OpportunityLineItem.Name, 'count')
.groupBy('OpportunityLineItem.Opportunity.Account', Account.Id)
.toAggregated();
groupByRollup
related
Signature
Queryable groupByRollup(String relationshipName, SObjectField field)
Example
SELECT COUNT(Name) cnt
FROM Lead
GROUP BY ROLLUP(ConvertedOpportunity.StageName)
SOQL.of(Lead.SObjectType)
.count(Lead.Name, 'cnt')
.groupByRollup('ConvertedOpportunity', Opportunity.StageName)
.toAggregated();
groupByCube
related
Signature
Queryable groupByCube(String relationshipName, SObjectField field)
Example
SELECT COUNT(Name) cnt
FROM Lead
GROUP BY CUBE(ConvertedOpportunity.StageName)
SOQL.of(Lead.SObjectType)
.count(Lead.Name, 'cnt')
.groupByCube('ConvertedOpportunity', Opportunity.StageName)
.toAggregated();
Code refactoring
Applied the Iterable
interface where possible for a small code refactoring to simplify the code.