02-27-2020 04:44 AM
Hello everyone,
I have an 'Enum' selector which identifies the channels in my digital signal. In order to set a name I need to convert the enum to a string (represented by the index number).
After I am done with the signal I want to do stuff to my signal dependent on the selection. Therefore I need to extract the channel name (index number) and compare it with my enum. I tried forcing a the resulting variant to the original enum, but apparently it does not recognize index the value as index number.
Is there a efficient way (or better a built in function) to select extract the correct enum value dependent on the index?
Note: The 'Input' may not always be a control. It will probably be in a class and only accessed via unbundle. Therefore property nodes may no be applied.
Solved! Go to Solution.
02-27-2020 04:49 AM - edited 02-27-2020 04:55 AM
Hi sh,
you set the enum (numeric) value as attribute of the waveform.
When you want to read that value from the waveform you should also read the attribute of the waveform (instead of trying to convert the whole variant)!
Btw. when using FormatIntoString you could even set the enum item as channel name instead of a plain numeric value…
You have to convert from string when you set the channel name as string:
02-27-2020 04:58 AM - edited 02-27-2020 05:06 AM
I oversimplified my problem. The Signal is generated via a Daqmx task (Daqmx Create Digital cannel.vi). Here the channelname only accepts String values, therefore I convert my enum to string.
EDIT: You were to fast. Fixed the problem based upon your post. Thank you