From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort Data by columns in a multicolumn listbox

Solved!
Go to solution

I have a multi-column listbox on the front panel with columns such as Name, Type, Date Modified, Size.

Is there any way to provide a facility to the user to sort the data in the listbox column-wise during run-time?  It should be similar to the one provided in Windows Explorer wherein the user can sort the data either by Name, Type, Size etc.

 

Thanks

Siddharth

0 Kudos
Message 1 of 12
(9,802 Views)

HI

 

           This sorting can be done it  in different ways. I have attached a Vi hope this helps you. Here i am sorting the 1st column wrt alphabetical order.

           Let me know if this works.

Message 2 of 12
(9,794 Views)
Hey,
i think it should be good !
I hope it is what you're looking for !
(Thanks to AutoTEC for sorting a 2D array ! 🙂 lool)
Let me know if it helps you !
Best regards, Vincent.
PS. : the Vi is in 8.5. You just have to run, and click on the name of the column you want to sort.
V-F
0 Kudos
Message 3 of 12
(9,781 Views)

Thanks for your response. I am using Labview 8.2 and hence unable to open the VIs sent by you. Can you please let me know how do I open these Vi's in Labview 8.2.?

 

Thanks,

Siddharth

0 Kudos
Message 4 of 12
(9,761 Views)

Thanks for your response. I am using Labview 8.2 and hence unable to open the VI sent by you. Can you please let me know how do I open these VI in Labview 8.2.?

 

Thanks,

Siddharth

0 Kudos
Message 5 of 12
(9,758 Views)
Solution
Accepted by Siddharth D
OK,  i joined the vi in Labview 8.0.
Let me know if it works.
Best regards,
V-F
Message 6 of 12
(9,750 Views)
Thanks for your help. It works!!!!!
0 Kudos
Message 7 of 12
(9,727 Views)

Siddharth D wrote:

I have a multi-column listbox on the front panel with columns such as Name, Type, Date Modified, Size.

Is there any way to provide a facility to the user to sort the data in the listbox column-wise during run-time?  It should be similar to the one provided in Windows Explorer wherein the user can sort the data either by Name, Type, Size etc.

 

Thanks

Siddharth


Hi Siddharth,

 

Have a look at the attachments & pl reply back if they fir your requirement like a 'T'. Smiley Wink

 

Both are saved for LV 8.0. Smiley Happy

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 8 of 12
(9,699 Views)

Tried your VI and it only works if there are no identical items in a column and you click on that column.   This is because the search function stops the first time it finds a value.  Identical values will be removed by the sort.

 

Also, the test for greater than or equal 0 means that there will be an already sorted result waiting which will execute next time you click in the main part of the list box (which returns a minus 2).  This test should be made before the sort.

 

Sorry,

 

Carsten

Message 9 of 12
(9,484 Views)

I know that this is an ancient thread, but I thought I'd add a sorting algorithm that works with data that has duplicates in it. Carsten is correct that a check should be performed before this sort is executed to ensure that the column index is not negative.

0 Kudos
Message 10 of 12
(6,348 Views)