0

Is it possible to order {exp:channel:entries} results based on the content of a Grid field? In my case, I want to order a list of conference sessions by start time.

This is the {exp:channel:entries} tag I'm using:

{exp:channel:entries channel="sessions" orderby="{session_time}{session_time:start}{/session_time}"}

The Channel Entries entry in the ExpressionEngine documentation doesn't state Grid fields aren't supported.

2
  • How would you order entries by Grid rows if there can be multiple rows per entry?
    – Low
    Jul 28, 2015 at 9:03
  • That's a fair point... this is the first time I've ever needed to order by grid contents and that particular grid is limited to just a single row. Went with another solution to the problem so, at this point, it's purely theoretical. Jul 29, 2015 at 14:03

1 Answer 1

1

You can only order entries by the literal contents of the fieldtype's column in the exp_channel_data table. So you can order by session_time (if you set that Grid field to be searchable - otherwise the column will not hold any data) - but you will be ordering by the concatenated contents of all columns and rows in that entry's session_time field.

You cannot specify a specific column in a Grid field to order by though.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.