LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

U16 to ENUM

Solved!
Go to solution

Hi,

I have a large text ring constant. I would like to convert it perminantly into an enum constant (not at run time, just for programming with). Anyone have any ideas how I might do this?

 

Cheers, Alec

0 Kudos
Message 1 of 8
(4,220 Views)

Look at the Right Click Framework.

 

There is one utility to create and Enum from an array of strings.

0 Kudos
Message 2 of 8
(4,210 Views)

how would you generate an array os strings from a Text Ring?

0 Kudos
Message 3 of 8
(4,208 Views)
Solution
Accepted by alecjcook

@alecjcook wrote:

Hi,

I have a large text ring constant. I would like to convert it perminantly into an enum constant (not at run time, just for programming with). Anyone have any ideas how I might do this?

 

Cheers, Alec


Provided the strings are not duplicated and the values are consecative then...

 

pop-up ring and choose make control.

pop-up on control and selecte replace >>> navigate to an enum

 

Done

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 8
(4,200 Views)

@alecjcook wrote:

how would you generate an array os strings from a Text Ring?


Try the documentation. For a text ring the Strings[] property returns the items as an array.

 

Message 5 of 8
(4,198 Views)

Create a property node for the text ring control.  There is a property called Strings[] that you can read to give you the array of strings.  Create an indicator wired to that and run your VI once.  Now you have an array of strings indicator.  Change that to a constant then use the right click tool on that to Create the enum.

0 Kudos
Message 6 of 8
(4,196 Views)

create a property node for the ring object and select the property "StringsAndValues[]", this will get you an array with a cluster element with the data your after.   you'll then have to use a for loop and extract the elements you need.

 

 

 

 

example.jpg

 

 

Message 7 of 8
(4,181 Views)
0 Kudos
Message 8 of 8
(4,160 Views)