LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ring control alphabetical order

Solved!
Go to solution

Hello

 

I have an Unsigned word Ring control. The Values to the ring comes from output of another VI. The number of items vary all the time.
 How is it possible to programatically order the items in the ringbox in alphabetic order ?

One can extract the string alone and order it alphabeically by sort 1d array function. But how to wire that one back to ring control to order it alphabetically? Is there any way to link the values to the strings?

 

Thanks

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 9
(3,636 Views)

Your question does not make any sense. Since you know how to read the property node to get the values and know how to sort the array, where is the problem. You do realize that you can write to the property node as well as read it, don't you?

0 Kudos
Message 2 of 9
(3,631 Views)

There is an easy way to do most of what you want.  First, make sure that 'Sequential Values' is unchecked for the ring.  Read the StringsAndValues[] property, sort it then write it back to the same property.  This will sort on the strings and keep their associated numeric values intact.

 

The problem is that sorting does not put the strings in alphabetical order all of the time,  lower case values come after upper case.  If the strings have consistent case then you are fine.  Otherwise you will need to convert the strings to upper (or lower) case before sorting and then map the values back to the original strings.

Message 3 of 9
(3,615 Views)

Thank you guys. Like Darin said it wrks perfectly for upper case values. For lower case values i converted them to upper case and sorted it then. But Is there a way to swap the the values? I mean to get a an output with new values and old item names? i.e sorted ring but with lowercases itself.


I treid to create a copy of the original ring and then did the Lower to upper case conversion . Now I have the values in alphabetical order but in UPPER case. 

What i need is to arrange them on basis of new Values.

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
Download All
0 Kudos
Message 4 of 9
(3,581 Views)
Solution
Accepted by topic author Nghtcrwlr

I think this will do the job. Sorted!

sort.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 5 of 9
(3,568 Views)

Hi,

 

gooooooooood solution

 

0 Kudos
Message 6 of 9
(3,559 Views)

My only quibble with the solution is that it is not always the first character which is capitalized.  I would change the entire string.

 

AlphabetizeRing.png

Message 7 of 9
(3,541 Views)

Example_VI_BD.png

Of course, you really don't need all that extra indexing baggage either just sort on the paired to uppercase cluster of rings and values 

 

A good use of bundle and unbundle (not by name)

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 9
(3,535 Views)

@Darin.K wrote:

My only quibble with the solution is that it is not always the first character which is capitalized.  I would change the entire string.

 


I agree, I just modified the OP's vi. Perhaps I should have pointed that out.

CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 9 of 9
(3,511 Views)