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: 

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
(3,336 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
(3,326 Views)

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

0 Kudos
Message 3 of 8
(3,324 Views)
Solution
Accepted by topic author 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
(3,316 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
(3,314 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
(3,312 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
(3,297 Views)

See the MacView blog entry:

 

How to Automate Creating Large Enums


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 8 of 8
(3,276 Views)