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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

sorting by two parameters


Go to End


3 Posts   2093 Views

Avatar
Victor

Community Member, 128 Posts

29 March 2009 at 4:52am

I want to sort by two parameters like in SQL "... ORDER BY `lastname`,'firstname`" but it seem not to work and I cannot find documentation

Thank you in advance. Victor

Avatar
Hamish

Community Member, 712 Posts

29 March 2009 at 11:06am

This should work:

$records = DataObject::get("SomeObject", "","SortFieldA ASC, SortFieldB ASC");

Avatar
Victor

Community Member, 128 Posts

29 March 2009 at 12:03pm

Edited: 29/03/2009 1:15pm

Yes, I found it. But on my way to find I found a strange error.
Thanks

Victor