You need to sign in to do that
Don't have an account?
Randy Bruck
Grouping query results by date in a pageblocktable
I have a custom object that tracks "breaks" in a Campaign. I have a query that returns all the records associated with the Campaign, but I would like to separate them into table blocks by each unique date (not knowing what the dates will be ahead of time).My query:
public List<brk__c> getBreak() {
return [
SELECT Break_Number__c,
Break_Date__c,
Start_Text__c,
End_Text__c,
Minutes__c,
Program__c,
Challenge__c,
Type__c
FROM brk__c
WHERE Campaign__c =: campId
ORDER BY Break_Date__c ];
}
And I have one table that looks like this:
What I want is a table for each set of records with the same date. Any help appreciated.
public List<brk__c> getBreak() {
return [
SELECT Break_Number__c,
Break_Date__c,
Start_Text__c,
End_Text__c,
Minutes__c,
Program__c,
Challenge__c,
Type__c
FROM brk__c
WHERE Campaign__c =: campId
ORDER BY Break_Date__c ];
}
And I have one table that looks like this:
What I want is a table for each set of records with the same date. Any help appreciated.
Check below examples of grouping query results.
https://blog.jeffdouglas.com/2011/03/02/dynamically-group-display-query-results/
https://developer.salesforce.com/forums/?id=906F0000000992RIAQ
Thanks,