0

I need to display a matrix of schedule, which has the fields: day, start_time, end_time. The day field is P&T Dropdown with the following values: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.

Since I cannot control what order the user enters rows in the matrix, I'd like to display the schedule in "proper" order, starting with Sunday and ending with Saturday. How do I order the matrix rows by day? If I do something like: orderby="day" sort="asc", it'll sort alphabetically.

1 Answer 1

2

Can you try by having P&T Dropdown options (in the field setting) like:

0 : Sunday
1 : Monday
2 : Tuesday
3 : Wednesday
4 : Thursday
5 : Friday
6 : Saturday

To output day name, you should use {custom_field_name:label} which will output Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.

If you are using {custom_field_name}, then it will output day number like 0, 1, 2, 3, 4...

2
  • It worked. Kindda. In CP, I see the drop down with Sunday, Monday, ..., as the drop down values. So, it's human readable. Then in my Safecracker form, I did orderby="day" sort="asc" and it seems to sort properly. The only problem is that it does not output the days. Instead it outputs the numbers. How do I display the day? Jul 2, 2013 at 1:35
  • 1
    You should use: {custom_field_name:label} which output the day name instead of number value (day number). Jul 2, 2013 at 2:05

Your Answer

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

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