ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Western PA LabVIEW Users

cancel
Showing results for 
Search instead for 
Did you mean: 

Possibly simple programming question

Good Morning folks,

I ran into a problem yesterday, and while I found a work around, maybe some of you can grant me some insight.

I have a type defined enum with maybe 5 or 6 items in it.. and I would like to put those values into an array.  Easy enough to make a constant sting array with those values, but it would be nice to be able to turn the enum into an array so that I reduce the chance of typos, and the code is expandable.

How might one do that?

Danke

0 Kudos
Message 1 of 4
(7,246 Views)

HI Danke,

In non-RT environments you can use teh property node "Strings" to get a list of the string sin the enum.

Under RT you can parse the enum type desciptor to get the strings.

Does that help or is there a challenge beyond that?

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(5,739 Views)

You can use the Strings[] property to programmatically get those values in an array.

B

BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 3 of 4
(5,739 Views)

I had a similar question previously  (you can find it in the User Forums:  "How do I print a Typedef containing an ENUM?" .  Here is a picture of the solution that I came up with.

Jason

Jason
.
0 Kudos
Message 4 of 4
(5,739 Views)