Cross posted here:
http://drupal.org/node/85149

Take a look at http://www.fitpod.com/fitmusic

It shows a table of CCK nodes. If you click on the BPM section to reverse the sort order, the sort isn't done correctly for a number. It appears to be performed like text (96 is higher than 110 in the new list).

The CCK node has BPM set up as integer using the text field widget.

Any ideas?

Thanks in advance for any help.

Comments

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Definitely a CCK issue if there's any real issue at all.

Using a 'text field' you're going to get a text based sort, which means that 100 comes before 99. You need to use an actual integer field to get a proper integer sort unless you store your numbers with leading digits, and I'm not sure CCK does that.

asimmonds’s picture

I am unable to reproduce this issue with a cck type made up of:
title: textfield
sortme: integerfield

Created a page view filtered on this cck type, with sort enabled on the sortme column, and it works as expected with ascending and descending sorting.

@amccann: The url you gave has restricted access, please post a public url that shows the problem that you are experiencing.

yched’s picture

Project: Views (for Drupal 7) » Content Construction Kit (CCK)
Component: Code » General

amccann, can you confirm ?

yched’s picture

Status: Closed (won't fix) » Active
Robardi56’s picture

Indeed, sorting numbers doesn't work properly when field is a text field, but works ok when field is set to integer or decimal.

Problem with number field is that if field is left empty, it forces a value of 0 to be displayed.

Any way to avoid this ?

Cordially,
Brakkar

yched’s picture

Title: Views not properly sorting CCK number field » empty = '0' value
Component: General » number.module
Status: Active » Closed (duplicate)

OK, then this is actuially a duplicate of http://drupal.org/node/82439