LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

can you sort a table control by multiple columns?

I have a table control that I want to be able to sort
on several columns. It looks like the SortTableCells function will pnly sort on one row or column. Is there a way to sort on several columns.
0 Kudos
Message 1 of 3
(3,530 Views)
The built-in sorting only works for a single row or column. You can write your own algorythm or send the data to Excel and process it there and read it back. See the Excel ActiveX examples if you want the latter approach in cvi\samples\activex\excel.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 3
(3,530 Views)
You have another alternative. If you define your own comparison function and pass it to SortTableCells, you can then use another column as a secondary sort key.
This way, when your callback is called at the time you need to compare two cells, you can then return the comparison result based not only on which of the cells is "greater," but also, if the cell values are equal, based on the comparison of the corresponding cells in a different column.

Does this make sense?

Luis Gomes
NI
0 Kudos
Message 3 of 3
(3,530 Views)