Property talk:Population
From semanticweb.org
Sorting of this attribute apparently is not working the way it was meant to. Top three entities having Attribute:Population in descending order are:
Zagreb 973,667
Leuven 90,143
Chad 9,749,000
It seems like sorting based on string characters (in ASCII "7" > "0" > "," ).
- Yes, in http://ontoworld.org/extensions/SemanticMediaWiki/skins/SMW_sorttable.js in the criterion for a number commas could be allowed (if (itm.match(/^\s*[\d\.\-eE\,]+\s*$/)) sortfn = ts_sort_numeric;), while the numbers without commas can be used as sortkey (aa = aa.replace(/,/g,''); and similar for bb), like in [1].--Patrick 02:19, 5 January 2007 (CET)
- The initial sort specified in the inline query works OK because it sorts on the value_num of a numeric-like attribute. You're right the JavaScript to sort the table doesn't. There is the same problem for sorting dates. I don't know whether the sorttable JavaScript code can use a hidden sort column provided by SMW. -- Skierpage 05:45, 8 June 2007 (CEST)
- One can use text in "display none" style in front of a data value (although currently refused by the spam filter), but for other things than strings that may not be suitable. One can also put it in a separate column but then we need a column with at least the width of the sort button, and that button is at the top of this extra column, not the column of the visible data concerned. For the commas (and also minus signs) it seems easiest to change the JavaScript code. I have done that on Meta, and partly on Wikipedia, see meta:Help:Sorting.--Patrick 12:54, 11 June 2007 (CEST)