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:

Archive /

Our old forums are still available as a read-only archive.

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

Sorting a DataObjectSet and ignoring upper- and lower-cases

Go to End

3 Posts   1426 Views


Community Member, 33 Posts

12 August 2008 at 11:24pm

Edited: 12/08/2008 11:25pm

Hey there,

I wonder if there is any method to sort a DataObjectSet by a Varchar field and ignore upper- and lower-cases. I just recognized that sorting puts the words with a lower-case at the end of the list which is not the way I wanna use the sort. Ideas anyone? Thanks in advance.



Community Member, 33 Posts

14 August 2008 at 7:01pm

I still didn't make it. If no ones got an idea, I need to write an own sort method, but I got some problems with it. Is there any method to change to items in a DataObjectSet?


Community Member, 33 Posts

15 August 2008 at 7:50pm

Edited: 15/08/2008 8:08pm

I just searched in the whole SS-Code wo get some more information about the iterator and how it should be used, but I just don't get it. If someone used it in his code, a Example Loop would be really nice. Thanks in advance



I tried something like this:

// Stuff
$someDataObjectSet = $someDataObjectSet->getIterator()->next(); 

But that won't work obviously since the "next()" function returns a DataObject instead of a DataObjectSet. Thats why I got trouble with the whole iterating thing ;)


Actually that was a bad example since it's the same like "foreach($someDataObjectSet as $someDataObject)", so I try to be more specifically. I need the iterate method to check if there is another DataObject right behind the current DataObject in the foreach loop. Any ideas?