LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sort array

Hello to all,
I would like to ask you a question.
I need to sort an array of numbers and strings.
Can I sort the array by name?

0 Kudos
Message 1 of 6
(3,453 Views)

What do you mean "sort the array by name"?  What name are you talking about?

0 Kudos
Message 2 of 6
(3,440 Views)

You're right. Forgive me.
For example I have:
Roma 9
Roma 8
Milano 8
Florence 9
Florence 20
Venice 10

I would like Milan, Venice, Florence and Rome ...
is it possible?

0 Kudos
Message 3 of 6
(3,436 Views)

Build a new array that strips out the numbers.  I'm sure there is a way to do a Regex that does it.  Or you could search for the space assuming you never have a name that has a space in it.

 

Then sort that array.  Then removed the duplicates.  (Search the forums because there have been many posts that discuss ways to remove duplicate entries.)

 

(Though I am not sure about your sorting because it should be Florence, Milan, Rome, Venice).  (And do you want Rome or Roma?  Milan or Milano?)

0 Kudos
Message 4 of 6
(3,432 Views)

I'm sorry, I explained I was wrong or inaccurate.
I enclose the table (array) I want to reorder.
Assuming that the column "Tratta" may have also different elements (not just Piacenza - Parma), I would be able to sort the table by clicking one of the elements of the columns (for example: sort the table by "Tratta" or by "Km", etc )

0 Kudos
Message 5 of 6
(3,416 Views)

This is really a completely different question than what you originally described.  Now you are trying to sort a 2-D array based on different columns.

 

See How to - 2 level sort for a 2D array.

0 Kudos
Message 6 of 6
(3,388 Views)