Arrange numbers natural not lexicographical

Anyone knows how to sort records on the live app in the normal order ? (1,2,3,4,5,) instead of this annoying (1,11,12,2,21,3,31,32)

Please do not tell me to put a leading zero as I have over 2000 records I cannot put 0001 0002 0003... There has to be another way.

Hi Nour - I might be missing something but my tables sort correctly. Clicking any of these columns sorts properly, and the only thing I can think of is that these are all number types (not text fields)?

I don't know about your original question, but a workaround could be adding the zeros, then adding a new calculated field that strips the zeros and use that field to show your information. Actually, that probably would leave you back where you started. Scratch that, I think.

Also, what kind of field are your numbers? When I add an auto-incrementing number field, then click the heading on the page to sort, it looks fine.

You ever get a solution? I cannot believe Knack does not have a way to sort numbers!

Hi @JerrellWil97366

The issue here is the difference between text and numbers. If the number is in a text field it will sort them 1 11 12.

You can use conditional rules and equations to fix this

Craig

Great. How?

Well that depends on the data you are storing in the field. Is it just numbers or numbers and text? Do you have an example of the data you are storing in the field?

It’s just numbers. It’s a number field. Only numbers.

I appreciate the response. Would love to get resolution.

If that’s the case it should order by number. It only sorts the other way if it’s a text formula or text field. I would get in touch with Knack support.

I’ve never seen a number field sorted that way.

Sorry if I misunderstood.

Craig

Actually, it doesn’t work that way. In a live app grid, knack sorts numbers as text. It’s very frustrating.

I’ve never had that issue. If it’s a number field it will always sort correctly. The only time it doesn’t is if it’s a text field.

As I said you should contact support for this. When I am back at computer I’ll demonstrate with some screenshots.

Craig

Thanks. I look forward to the screenshot. And to be clear, I’m talking about sorting a grid in a live app (according to a number field), not a table in the builder.

Yes

Hi

So this is a number field with a custom suffix sorted:

This is a text formula field that equals a number field + w sorted:

That’s an example of sorting a table in the builder. Try the same thing with a grid in a live app.

That is my live app.

I see my problem. I grouped the grid on the number field. Apparently, grouping prevents sorting on the number field. Also, I really don’t want the use to have to force the sorting. I’d rather it sort for the user.

Hi number fields sort correctly when grouped:
image