If you want to do more complex sorting; I have an example I made a long time ago that reads values from datalinq and sorts them then generates an animation on the fly to animate them into their correct sorted order..
It's a bit complicated to set up but here it is:
https://ross.brickftp.com/f/c7f2cec1a
Just unpack it and load the DSC file into datalinq server and point the datalinq to wherever you put the .TXT file.
Then put the scene online from the sequencer.. You can then edit the data in the text file, save it, and resume the Pause on the sequencer item and the order should re-animate to the new sorted order.
You'll find the script on the scene director that performs the sorting and generates the animation keyframes.
Its basically loops over all of the text objects to find the one with the highest value; then loops again to find the next highest, etc, until it has found them all in descending order. As it loops, it assigns keyframes to an animation controller. At the end of all the looping it plays the animation controller.
#XPression