01-09-2026 02:55 PM
I made this a long time ago.
01-10-2026 10:47 AM - edited 01-10-2026 10:57 AM
In the end, for columns that contain numeric data, I followed altenbach: Convert the column to floats, bundle each float with the string array for the corresponding line, sort the resulting array of clusters, unbundle to retrieve nicely ordered lines. Nice!
For alphanumeric columns, I did an explicit alphalogical bubble sort (courtesy of Jared_B from this 2010 forum post). I modified the sort so that whenever the algorithm swaps two values in the 1D array of strings, it also swaps the corresponding values in an array containing the line indices (0, 1, 2, ... n-1). I then use the resulting swapped array of indices to reorder the table lines. I believe this is jjohn1's keysort solution.
Thanks for all the input. Very helpful.
David
01-10-2026 04:17 PM
@FlatCat wrote:
In the end, for columns that contain numeric data, I followed altenbach: Convert the column to floats,
I don't remember mentioning anything about "floats", so I am not sure what you did.
@FlatCat wrote:
For alphanumeric columns, I did an explicit alphalogical bubble sort (courtesy of Jared_B from this 2010 forum post).
Did you try my solution with the "magic subVI". It works equally well on alphabetic, numeric or mixed strings with any number of mixed fields, so no column specific decision needs to ever be made. It also uses the stock LabVIEW sort, which might be more efficient than anything hand-coded. I'll probably add an input to select case sensitivity, though.
01-10-2026 05:59 PM - edited 01-10-2026 06:06 PM
OK, I cleaned up the code a little. See if this is useful.
The term "alphalogical" is a bit uncommon and google finds mostly links to the NI forum. Windows explorer calls it "Numerical" and that's what I am using.
01-10-2026 09:08 PM - edited 01-10-2026 09:10 PM
@altenbach wrote:
@FlatCat wrote:
In the end, for columns that contain numeric data, I followed altenbach: Convert the column to floats,
I don't remember mentioning anything about "floats", so I am not sure what you did.
@FlatCat wrote:
For alphanumeric columns, I did an explicit alphalogical bubble sort (courtesy of Jared_B from this 2010 forum post).
Did you try my solution with the "magic subVI". It works equally well on alphabetic, numeric or mixed strings with any number of mixed fields, so no column specific decision needs to ever be made. It also uses the stock LabVIEW sort, which might be more efficient than anything hand-coded. I'll probably add an input to select case sensitivity, though.
Here's an alternate for your magic VI (requires LV 2020+).
01-10-2026 10:11 PM
I don't remember mentioning anything about "floats", so I am not sure what you did.
I know beforehand whether any column contains purely numeric data, so for those columns I just used your original solution of converting the text to a DBL ("float") and bundling with the row strings before sorting.
But yours and Paul's "magic" vi's are much more elegant, so I will look into adopting some form of those.
01-10-2026 10:17 PM
@paul_a_cardinale wrote:
Here's an alternate for your magic VI (requires LV 2020+).
Sorry, can't open it in 2020.
01-11-2026 07:28 AM
@altenbach wrote:
@paul_a_cardinale wrote:
Here's an alternate for your magic VI (requires LV 2020+).Sorry, can't open it in 2020.
Sorry, I wrote that incorrectly. It actually requires 2021+. However the only 2021 feature that it uses is the concatenating of strings by a tunnel.
Attached is a 2018 workaround.
01-11-2026 10:06 AM
Ok. These really ARE magic. Such a satisfying and simple way to solve the problem, and one that I would never have thought of. Many thanks.
01-11-2026 10:21 AM - edited 01-11-2026 10:56 AM
Yes, I got the gist of it from the picture
You are padding with spaces (i.e. a non-numeric character) while I am padding with zeroes (i.e. a numeric character)..
I am curious if there could be edge cases where it would make a difference, but haven't explored that.
One simplification would be to use the upper input of the format, eliminating your inner concatenation.