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.

Does the 'orderby' parameter sort numbers alphabetically?

December 02, 2010 6:48am

Subscribe [2]
  • #1 / Dec 02, 2010 6:48am

    Can anyone tell me if the ‘orderby’ parameter sorts alphabetically in all cases.

    If a custom field is used and it contains a number is the sorting numeric or alphabetic?

    I am using a custom field to control the display order of images and the field contains numbers.

    Many thanks, Jack

  • #2 / Dec 02, 2010 2:58pm

    Rob Allen

    3118 posts

    Yes it always uses alphabetical ordering, but if you’re using numbers you always sort on the first digit, eg

    1
    11
    12
    2
    21
    22

    To do numerical ordering you may find that you want to adopt 2 or 3 character numbers to keep things in sequence, eg

    10
    11
    12
    20
    21
    22

  • #3 / Dec 03, 2010 5:45am

    Thank you for your reply that’s very helpful.

    Best…Jack

  • #4 / Dec 03, 2010 10:08am

    Ingmar

    29245 posts

    So, you’re good?

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

ExpressionEngine News!

#eecms, #events, #releases