Sorting a Database in Numerical Order

Hello,

I have a database which contains data of sports team rankings/points and need to sort them in order of points, however when I sort A-Z it sorts it digit by digit ie. 10, 136, 23, 267, 3, 49, when what I actually need is 3, 10, 23, 49, 136, 267 (or the other way around).

Any suggestions?

Hey Rob!

That field where you save points/rankings data is probably a text field that’s why it sorts it out alphabetically. 10, 136, 23, 267, 3, 49, is alphabetical. Change it to number

I came up with a work-around if you’re still interested. I needed the field to be text so setFilter() / find() would work. But had the same problem with an alpha sort instead of numeric. So I created two fields, one numeric, one text with the same number stored as a number and string respectively. Then I displayed the numeric field in the table and sorted by it. I deleted the duplicate text field from the table. But perform the searches on it.

Hi Mert can you say me how can be the code?
i have the this problem:

what i like to do is sort a repeater using (setSort) and (ascending) and i did this:
export function preciomenoramayor(event) { $w(" #dataset1 “).setSort( wixData.sort() .ascending(“precio”) ); } export function preciomayoramenor(event) { $w(” #dataset1 ").setSort( wixData.sort() .descending(“precio”) ); ------------------------------- it is working, but the problem is: no recongice correct the order because take count the first number and not all the number; for example it sort of this way: 1200 1300 1400 800 put 800 after 1400 because start with “8”.