LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enum to Digital_Waveform attribute and back

Solved!
Go to solution

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. 

 

enum2variant.png

 

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.

0 Kudos
Message 1 of 3
(2,192 Views)
Solution
Accepted by topic author s.h._tech

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:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(2,189 Views)

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

0 Kudos
Message 3 of 3
(2,174 Views)