I have a list of numbers.
[
1,
2,
3,
1.1,
1.2,
1.3,
1.11,
1.12,
2.1,
2.12,
2.2,
2.3,
3.1,
3.11,
3.2
]
I want to sort this list in such a way that it becomes like this.
[
1,
1.1,
1.2,
1.3,
1.11,
1.12,
2,
2.1,
2.2,
2.3,
2.12,
3,
3.1,
3.2,
3.11
]
How can I achieve this?
Hi AJ,
I have tried your instruction but I have an error: Value has some invalid arguments.
Any pointers?
I re-read the question and believe I understand what you are asking better this is an example of what I would do to accommodate up to 4 "." e.g. 1.2.3.4.5
for my example i will call my datasource 'ABC' and my decimal number column 'numb'
So i go to my gallery and add in this
SortByColumns(
AddColumns(
ABC,
"BefD",
Value(
First(
Split(
ThisRecord.numb & ".0.0.0.0.0",
"."
)
).Result
),
"Aft1D",
Value(
Last(
FirstN(
Split(
ThisRecord.numb & ".0.0.0.0.0",
"."
),
2
)
).Result
),
"Aft2D",
Value(
Last(
FirstN(
Split(
ThisRecord.numb & ".0.0.0.0.0",
"."
),
3
)
).Result
),
"Aft3D",
Value(
Last(
FirstN(
Split(
ThisRecord.numb & ".0.0.0.0.0",
"."
),
4
)
).Result
),
"Aft4D",
Value(
Last(
FirstN(
Split(
ThisRecord.numb & ".0.0.0.0.0",
"."
),
4
)
).Result
)
),
"BefD",
Ascending,
"Aft1D",
Ascending,
"Aft2D",
Ascending,
"Aft3D",
Ascending,
"Aft4D",
Ascending
)
You will need to change ABC to the name of your datasource. You will need to change anywhere you see numb to your decimal column.
i have tested it out in an app i built for this see the below picture of what your gallery should sort like:
I am slightly confused by the question apologies if I am not understanding are you saying that the there might be more than one decimal point (if so how many decimal points) or are you asking something else 🙂
@AJ_Z
Amazing solution, but what is the number of "." in the value is not just one but N number of ".". Than how should we handle this?
Let me know if my above suggestion works for you 🙂
this is possible but many people do it different ways I do this using AddColumns(),Split(),SortByColumns() and If().
for my example i will call my datasource 'ABC' and my decimal number column 'numb'
So i go to my gallery and add in this
SortByColumns(
AddColumns(
ABC,
"BefD",
Value(
First(
Split(
ThisRecord.numb,
"."
)
).Result
),
"AftD",
If(
CountRows(
Split(
ThisRecord.numb,
"."
)
) = 1,
0,
Value(
Last(
Split(
ThisRecord.numb,
"."
)
).Result
)
)
),
"BefD",
Ascending,
"AftD",
Ascending
)
You will need to change ABC to the name of your datasource. You will need to change anywhere you see numb to your decimal column.
i have tested it out in an app i built for this see the below picture of what your gallery should sort like:
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2