To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This VI demonstrates how to convert the string into the appropriate enum value.
Description
You would need to turn this into a subVI, then take the subVI output and use that as the case structure input. There is a neater way: you can bundle it into a cluster, and then unbundle from your type defined enum placed inside a cluster shell.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Snippet
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Hey Joel.
This will work too using the "Scan From String" function, but if your text doesn't match any of the entries in the enum, you will get an error 85 message.
Rob
I am also a fan of just using the Scan From String. It does everything your code does, but faster and a whole lot smaller.
Whaou!
This trick with Scan from string is exactly what I needed!!
Actually, I used it from enum to string, but didn't know how to use it from string to enum.
The fact is that when you use an executable (particularly in RT), you can't access to "Strings[]" property because UI is removed, so property nodes don't work anymore. This trick will save my life ^^
Olivier L. | Certified LabVIEW Developer
One caveat: if the enum contains "One", Two", "Three", and the string scanned from is "Oneasdf", scan from string will return the enum value "One".
For Reference: You can simply cast an Integer to an Enumeration. I'd include a snippet, but it doesn't seem to want to upload.
Hi
maybe you can use this solution