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.

custom number field not sorting

August 18, 2011 5:13pm

Subscribe [3]
  • #1 / Aug 18, 2011 5:13pm

    mint

    42 posts

    I need to sort entries by a custom number field. Custom field is set to Text Input and field content to number. (EE 2.2.1)

    I have entries with numbers from 1 to 22 and expect them to be in this order.

    {exp:channel:entries orderby="{poi_number}" sort="asc"  channel="poi"  category="{segment_2_category_id}" dynamic="no" disable="member_data"}
    {if no_results} No Results {/if}
      <li value="{poi_number}" data-geo-lat="{p_lat}" data-geo-long="{p_long}">
      <h4><span>{poi_number}</span> {title}</h4>
    <p>   <div class="longdesc">{p_body}</div><br />
      </li><br />
    {/exp:channel:entries}


    This is the order displayed:

      1 Kailua Seawall
      3 Hulihee Palace
      2 Pa o Umi
      5 Hale Halawai
      4 Mokuaikaua Church
      6 Oneo Bay
      8 Kahului Bay
      7 Waiaha Beach Park
      11 Holualoa Bay
      12 Holualoa Royal Center
      10 Puapuaa (Banyans Surf Site)
      9 Hale Halawai o Holuloa (Living Stones Church)
      15 Laaloa Bay Beach Park
      13 Judd Trail
      14 Pahoehoe Beach Park
      17 Kuemanu Heiau
      16 Laaloa Bay
      18 St. Peter’s by the Sea Catholic Church
      19 Kahaluu Bay Beach Park
      21 Hapaialii & Keeku Heiau
      20 Helani Church/Ohiamukumuku Heiau
      23 Heritage Corridor Overlook
      22 Makolea Heia

  • #2 / Aug 18, 2011 6:15pm

    Mark Bowen

    12637 posts

    Try this instead :

    {exp:channel:entries
            orderby="poi_number"
            sort="asc" 
            channel="poi" 
            category="{segment_2_category_id}"
            dynamic="no"
            disable="member_data"}
    
    {if no_results} No Results {/if}
      <li value="{poi_number}" data-geo-lat="{p_lat}" data-geo-long="{p_long}">
      <h4><span>{poi_number}</span> {title}</h4>
    <p>   <div class="longdesc">{p_body}</div><br />
      </li></p>
    
    <p>{/exp:channel:entries}

    Basically I took out the brackets surrounding your custom number field {poi_number} as they shouldn’t be needed for this to work.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #3 / Aug 18, 2011 6:45pm

    mint

    42 posts

    Mahalo Mark, this worked… didn’t think to try this since most parameters need curlys…

  • #4 / Aug 18, 2011 7:28pm

    Mark Bowen

    12637 posts

    Mahalo Mark, this worked… didn’t think to try this since most parameters need curlys…

    ‘A’ole pilikia glad that worked for you. As a matter of fact most standard ExpressionEngine parameters don’t use brackets. I think you are perhaps referring to variables maybe?

    Best wishes,

    Mark

  • #5 / Aug 19, 2011 10:28am

    Kevin Smith

    4784 posts

    Thanks for the assist on this, Mark! mint, did this get you all squared away?

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

ExpressionEngine News!

#eecms, #events, #releases