Use a cast to order rows returned by fetch


#1

Hi,
is possible to order a fetch result based on a field that is of type string but I want to cast it to int?

I mean, if I have a series of id as 1, 2, 3, 4, … , 9, 10 , 11…
If I launch a fetch and I use order:“descending(id)” the system returns a list of rows ordered like:
1 —
10 —
11 —

19 —
2 —
21 —
I would like to have a list ordered like:
1 —
2 —
3 —

9 ----
10 —

Is possible?

Thanks,
Laura


#2

Could you do descending(number(id)) ?


#3

Hi,
it works.

Thanks,
Laura