How To: Advanced Data Retrieval with Named Queries
Use aggregates, filters, offsets, and grouped results to return exactly the values you need from a named query.
Before you start
Pattern 1: Return aggregate values
<!--{{!
<lineitemsSOQL>
<queryname>OpportunityStats</queryname>
<soql>
SELECT COUNT(Id) cid, SUM(Amount) asum
FROM Opportunity
WHERE AccountId = '{{!Account.Id}}'
</soql>
</lineitemsSOQL>
}}-->Pattern 2: Target a specific row with offset
Pattern 3: Reuse one query with filter and offset
Pattern 4: Handle aggregate lookup fields carefully
Common fixes
Keep going
Last updated
Was this helpful?

