LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i get from enum items name.

Solved!
Go to solution

Hi,

 

An enum contains the names in its type definition, and this can not be changed in run time.

 

Cut from the help of the Strings[] property: "If the string is an enumerated type control, you cannot write this property when the VI is running"

 

If you wish to edit the strings programatically I believe using a text or menu ring is the way to go.

 

Regards

//Martin



CLA
https://www.prevas.se/expertis/test--regulatoriska-krav.html
0 Kudos
Message 11 of 25
(3,199 Views)

Hello Siva,

 

To add to the discussion, you may find the following KnowledgeBase article useful:

 

What is the Difference Between a Text Ring and an Enum?

http://digital.ni.com/public.nsf/allkb/79BA4505AE8C755E86256FB2000140B0

 

 

0 Kudos
Message 12 of 25
(3,160 Views)

As it has been pointed out, you can't change the items in an enum at runtime. You can however enable and disable (gray-out) items at runtime. Perhaps that helps.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 13 of 25
(3,146 Views)

> download the OpenG toolkit, ...has a special 'enum to strings' VI

 

openg.org no longer exists. Support is now through lavag.org. See OpenG's Get Strings from Enum__ogtk.vi

0 Kudos
Message 14 of 25
(2,583 Views)

> if ... you want to know the possible string values of an enum...

> download the OpenG toolkit, ... 'enum to strings' VI

See https://sourceforge.net/projects/opengtoolkit/ and Get Strings from Enum__ogtk.vi

0 Kudos
Message 15 of 25
(2,592 Views)

Hi dwb,

 

thanks for bringing back this old thread!

 

What's wrong with the "Strings[]" property of the enum? No need to download any library of VIs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 25
(2,598 Views)

@GerdW wrote:

Hi dwb,

 

thanks for bringing back this old thread!

 

What's wrong with the "Strings[]" property of the enum? No need to download any library of VIs…


Not sure if it is currently a complication but...

 

In RT (LV 6.1) the FP control properties do not work. Drove me nuts that I could step through the code and see it work but when run as an exe, no-workie.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 17 of 25
(2,591 Views)

GerdW,

 

> What's wrong with the "Strings[]" property of the enum? No need to download any library of VIs…

 

I was really just updating information from another persons post because the URL and VI name have changed, but, if you want a list of the strings (or just the number of them) from a Block Diagram enum constant, that library function does it. I didn't want to create a Front Panel object just to be able to access the properties.

0 Kudos
Message 18 of 25
(2,582 Views)

@GerdW wrote:

Hi dwb,

 

thanks for bringing back this old thread!

 

What's wrong with the "Strings[]" property of the enum? No need to download any library of VIs…


Or the 'Type def to strings' from the Variant function panel, no property nodes needed. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 19 of 25
(2,563 Views)

@Ben wrote:

Not sure if it is currently a complication but...

 

In RT (LV 6.1) the FP control properties do not work. Drove me nuts that I could step through the code and see it work but when run as an exe, no-workie.


It is still that way.  It makes sense because there is no front panel loaded when an RT application is running.  Exceptions are the remote front panels and the cRIO-903X controllers that have a Display Port that you can enable.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 20 of 25
(2,554 Views)