LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically reorder elements in cluster

Hi,
 
is there a possibility to programmatically reorder elements in a cluster?
 
I have an 1-D array of clusters with three elements (2 strings, 1 boolean) and want to order the array elements with respect to one of the three cluster elements. The only way I can see right now to do that is to index the array, rearrange the cluster elements so that the element under scrutiny comes first, rebuild the array, use the sort function, and finally bring the cluster elements back into their original order.
 
You probably already guessed what the purpose is. I need to realize a typical multicolumn list with the opportunity to sort the lines with respect to a particular column. Yes, I know there is a ready to use multicolumn list control but I found it rather puzzling at the first glance. How do I get the array described above from that multicolumn list?
 
Any thought or hint appreciated.
 
Peter
0 Kudos
Message 1 of 3
(3,677 Views)
If you're trying to deal with a multicolumn listbox in the first place then you're better off just dealing with that rather than trying to play games with clusters. What exactly is puzzling you about the multicolumn listbox? The cell elements are available through the "Item Names" property node. Right-click on the control and select "Create->Property Node->Item Names". This property node provides a 2D array of strings that you can sort and then write back to the control using the same property node. As for sorting the 2D array, you can do so with the OpenG tools. Their Array library contains a 2D sort function.
0 Kudos
Message 2 of 3
(3,668 Views)
I think your proposed way of gfoing about it is about right.

You could also have seperate arrays of each element in particular with a second cluster iterm indexing it's position in the "original" array.  This way you can simply sort the single array à(with index value) and re-build from that.

Shane.

PS Of course, using the multicolumn listbox would be better.......

Message Edited by shoneill on 09-11-2007 04:56 PM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 3 of 3
(3,668 Views)