The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Views: how can I order by time field


This Discussion is public


I have a time field and want to order my view entries ascending using that view. Is this possible, as I can't see an option to the Time field in the Order option of Sort & Filter.

I've tried Editing this post, but no luck.

I've think I've found out the issue. The time fields are not showing as they're part of a Repeater section. Is there any way to order the entries using such the first time of a repeater section?

There is a filter you can use to create a custom order by:

But, because your field is in a repeatable section, the code may be a little complicated and there are no examples that I know of that you can go by. You would have to examine the content of the $query and $args variables to determine exactly what you would have to change the order by to.

Keep in mind that repeatable sections are actually separate forms and function as child forms to the main form. As I think through the SQL query that would be required to this if I were accessing the DB directly, it would be pretty complex. That's why you have to know exactly what's available to you in those two variables. You can either use var_dump() or install the Kint debugger to examine the variables.

Thanks vfontjr. I've reworked the form slightly to have a start date and start time, outside of a repeating group. This achieves what I want. Thanks.

Discussion closed.