From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert number to enum

Solved!
Go to solution

I've defined a custom type (enum) like:

 

Machine_State:

- 0: Idle

- 1: Start

- 2: Stop

- 3: Running

 

Now I want to convert a number to a enum variable like:

 

Parameters.Result_Machine = (Enums.Machine_State).Locals.Result

 

 

Locals.Result is a number e.g. 2

Parameters.Result_Machine is type Machine_State (enum)

 

 

 

0 Kudos
Message 1 of 3
(2,710 Views)
Solution
Accepted by topic author Struct

The help shows how to cast: https://zone.ni.com/reference/en-XX/help/370052AA-01/tsfundamentals/infotopics/enumsastsexpressions/

 

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 3
(2,679 Views)

Thanks

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