Sorting by Number
4 posts by 3 authors in: Forums > CMS Builder
Last Post: August 29, 2008 (RSS)
By InHouse - August 28, 2008
I would like to sort the records in a Section Editor to be displayed based on the order of a text field in that Editor. This field will only store integers.
When I sort by this field, the sorting is that silly format where it looks like:
11
12
13
1
2
21
22
23
3
etc.
Is there any way around this? I don't want to have to enter 01 instead of 1.
Cheers,
J.
When I sort by this field, the sorting is that silly format where it looks like:
11
12
13
1
2
21
22
23
3
etc.
Is there any way around this? I don't want to have to enter 01 instead of 1.
Cheers,
J.
Re: [InHouse] Sorting by Number
By kevbarker - August 28, 2008
Take a look at this post and see if it will take care of what you want to do:
http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/Sorting_by_Number_P64888/gforum.cgi?post=62291;search_string=sorting%20number;guest=22972822&t=search_engine#62291
Kevin
http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/Sorting_by_Number_P64888/gforum.cgi?post=62291;search_string=sorting%20number;guest=22972822&t=search_engine#62291
Kevin
Re: [InHouse] Sorting by Number
By Dave - August 29, 2008
There's lots of ideas in that thread Kevin suggested. I usually use: ORDER BY fieldname+0
And that forces it to be a number. It's because it's sorting them alphabetically and not numerically.
Let me know if the fieldname+0 or one of the other solutions works for you.
And that forces it to be a number. It's because it's sorting them alphabetically and not numerically.
Let me know if the fieldname+0 or one of the other solutions works for you.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] Sorting by Number - Answered.
By InHouse - August 29, 2008
Thanks all.
Dave, I suspected that was the cause. The sort by fieldname+0 solution worked like a charm and was a bit less invasive than the other option (which also worked BTW).
Sorry for the extra posting! I knew I had seen a thread on this topic before but somehow managed to miss it in my search.
J.
Dave, I suspected that was the cause. The sort by fieldname+0 solution worked like a charm and was a bit less invasive than the other option (which also worked BTW).
Sorry for the extra posting! I knew I had seen a thread on this topic before but somehow managed to miss it in my search.
J.