LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert string array to enum at runtime

Solved!
Go to solution

Could you give me an litte example?

0 Kudos
Message 11 of 24
(4,734 Views)

yes - why not?

0 Kudos
Message 12 of 24
(4,733 Views)

Try this:

VI snippet.png

Add the sheet names to the enum control, and they will be converted to strings

0 Kudos
Message 13 of 24
(4,730 Views)

thanks.

I'm also confused. The output is an array, and should be an enum.

Capture.PNG

0 Kudos
Message 14 of 24
(4,722 Views)

You said you want the user to select a sheet name stored in an enum, and that would drive the active displayed worksheet in excel. Assuming you are using the Report Generation Toolkit to do this, the input to the Excel Get Workstheet.vi is a string:

Capture.PNG

So you would need to format the selected enum value into a string:

VI snippet.png

0 Kudos
Message 15 of 24
(4,720 Views)

Yes that's the way. But I still haven't got the enum. The output from the snip was an array.

Or am extremely stupid ? 😉 

0 Kudos
Message 16 of 24
(4,719 Views)

I think I understand now. You are pulling in the excel sheet names into labview as an array of strings. You then want to populate an enum control with those strings, and have the user select one to change the active worksheet?

 

There is no way to edit the values of an enum at runtime that I am aware of.

0 Kudos
Message 17 of 24
(4,717 Views)
Solution
Accepted by topic author Michael.Koppelgaard

@sirwin wrote:

I think I understand now. You are pulling in the excel sheet names into labview as an array of strings. You then want to populate an enum control with those strings, and have the user select one to change the active worksheet?

 

There is no way to edit the values of an enum at runtime that I am aware of.


As Ben previously mentioned an enum can only be edited at edit time, is fixed a runtime. You could use your "read in array of names" to populate a  ring control, then use the output of that to index the original array of names to get the desired name to select the active sheet.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 18 of 24
(4,706 Views)

I didn't think about it that way. That would certainly work. Note to self...

0 Kudos
Message 19 of 24
(4,699 Views)

Great !
Would you be kind to make a small example ?

0 Kudos
Message 20 of 24
(4,683 Views)