Custom Perspective Table Sorting

Is it possible to customize how a table sorts to allow sorting a column based on something other than the value that is visible in the table?

For instance, I have a table showing database values that exist as some decimal number of hours, 2.92, 1.16, 0.36, etc. and they are currently being formatted (by the database query) as a more human-readable string such as 2 hours 55 minutes, 1 hour 10 minutes, 22 minutes, etc.

So the table is showing the formatted value, but of course since it’s a string, it doesn’t sort based on the numeric value quite right.

Is there any way to specify or script it such that when sorting this column, the value used for sorting is the actual decimal number of hours rather than the table trying to sort based on the string? I’ve looked and can’t think of or see a way to do this and just wanted to make sure I’m not missing anything.

This would also be useful for sorting IP addresses.



Of course, this has to work for each of the four octets.

Anybody got a good trick?