Michiel Pruijssers
ย ยทย Tinkerer. Designer.

Odd/Interesting find: sorting a list of children based on a custom function key gets number formatted auto-applied but is not set

Resolved

Hey folks,

I am having a weird issue and would love to tap in the wisdom of the crowd to help me resolve this or we can create a new bug report maybe ;)

So here's what I am doing: I building an app in which I need to sort a bunch of real-world locations based on the distance of the user.

To make this possible, I wrote a custom function to determine the distance between a location and where the user is.

I currently have a list that I am generating & sorting based on creating a distance-from-user sorting key. This helps me to sort a pretty long list of locations from nearest to farthest to the user and is done using a custom function.

Now, the problem I encountered is the following: I noticed a rather odd discrepancy in the sorting itself. (see screenshot attached). It seems that the sort is happening based on a number formatting option. This number formatting option is not setup when the mapping of the list is generated. Super odd...

Here's the list sorted list:

Note how the sorting is somewhat accurate... until it goes from "52.1 miles" to "5.2K miles" away and then back to "60.6 miles"

Here's how my sorting key gets generated:

As you can see, there is no number formatting setup.

Additional update: I also tried forcing it by applying the decimal formatting option, but not no success with this as well.

Any thoughts on how I can resolve this?

1
9 replies