LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can you get the index of an enum instead of the value of the enum?

Solved!
Go to solution

Im new to labview and I am trying to read out the index of an enum oppose to the string value the enum has.

i.e. for example an enum of values 1, 5, 10, 20 with indexs 0,1,2,3  I want to take the index value to use in a code as a string,

so take the 0,1,2,3 values 

 

Are there any simple solutions?

 

Cheers,

 

JimJamBot

0 Kudos
Message 1 of 5
(9,404 Views)
Solution
Accepted by topic author JimJamBot

It is already a number.

 

Try using a "to I32" or similar from the numeric palette.

 

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 5
(9,394 Views)

That worked, Thank you!

 

JimJamBot

0 Kudos
Message 3 of 5
(9,389 Views)

Enums also have amazing feature when converting them to string:

If you wire it into Format into string and specify %d as formatting, it will be numeric string (0, 1, 2...). If you specify %s, it will be string you see on block diagram (1, 5, 10, 20) in your case

Message 4 of 5
(9,352 Views)

That's cool, I think that just made a load of my code alot simpler,

 

thank you,

 

 

JimJamBot

0 Kudos
Message 5 of 5
(9,327 Views)