ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

sorting text as numbers

February 28, 2012 1:29pm

Subscribe [2]
  • #1 / Feb 28, 2012 1:29pm

    mdonohue

    19 posts

    Is there any way to sort text as numbers correctly without having to change the field to an integer?  I have a field that has room names, which are most often numbers, but sometimes names so I can’t change the field to integer.  How can I get them to sort as 100, 102 instead of 100, 1000, 102?

    Thanks!

  • #2 / Feb 29, 2012 11:58am

    Shane Eckert

    7174 posts

    Hello,

    Thank you for posting your questions.

    I do not believe you can do this with ExpressionEngine without using some extra measures.

    You may have to use a custom SQL query using the Query Module or some custom PHP or JavaScript to make this work.

    If you would like I can move this thread over to the Community Help Forum. It’s likely that other users have run into this before.

    Cheers,

  • #3 / Feb 29, 2012 2:00pm

    mdonohue

    19 posts

    I have done it with the Query Module for a different page, but I was hoping there was a simple way to do this using the regular channel entries tags.  Please send me the link once you’ve moved the post.  Thanks!

  • #4 / Mar 01, 2012 1:20pm

    Shane Eckert

    7174 posts

    Hello mdonohue,

    Moving you on over!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases