Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

GroupBy is not supported in DataList for SilverStripe 3 ?

Go to End

2 Posts   3542 Views


Community Member, 8 Posts

13 May 2012 at 10:47am

Hi there,

I am struggling to convert the code below from the tutorial ( to Silverstripe 3. I understand using DataList is a recommend approach and DataObjectSet is depreciated, but it seems that Group By is not supported in DataList.
Anyone has idea how to make the code working using SilverStripe 3’s new ORM like ?

function BrowserPollResults() {
$submissions = DataObject::get('BrowserPollSubmission');
$total = $submissions->Count();

$doSet = new DataObjectSet();
foreach($submissions->groupBy('Browser') as $browser => $data) {
$percentage = (int) ($data->Count() / $total * 100);
$record = array(
'Browser' => $browser,
'Percentage' => $percentage
$doSet->push(new ArrayData($record));

return $doSet;


Community Member, 19 Posts

25 June 2012 at 11:28am


for simmilar functionality you can use GroupedList:

$groupedSubmissionsList = new GroupedList($submissions);
$grouped = $groupedSubmissionsList->groupBy("Browser");