Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

Sort CB List by the MMDD component of a date field

11 years 5 months ago #226422 by mcberstene
I have tried several methods but am not getting closer to a solution, so I am tapping into the knowledge of the forum.

I have several lists where I want to ignore year when I sort a list by date. One is birthday where I want all of the birthdays ordered within a year, not by the year of birth. Another is a list of death dates where I want to order the list by the month and day and to ignore the year.

Any suggestions would be helpful. I can generate the required mmdd using a CB Query field, but these fields are not available for sorting.

Michael
Joomla 2.5.11
Apache 2.0.64
MYSQL 5.1.47
CB 1.9 loaded via quickstart pro 1.5

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
11 years 5 months ago #226433 by krileon
Query fields can't be used for sorting. Sorting uses the ORDER BY of the query on a _comprofiler column and query fields don't store to database so can't be sorted on. Only solution is to push the date-month to a new field (text field?) using CB Auto Actions maybe. Then sort by that new fields. Date fields always store with year, month, and day.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum