Using Enumerations with the TestStand Adapters
- Updated2025-07-23
- 4 minute(s) read
Sequence Call Adapter
The type of variable passed for an enumeration parameter must exactly match the parameter type in the sequence being invoked.
C/C++ DLL and LabWindows/CVI Adapters
There are two ways to pass enumeration parameters to the C/C++ DLL and LabWindows/CVI adapters:
- Pass a number specifying the numeric value of the parameter.
- Pass a TestStand enumeration instance. (Requires TestStand 2016 or later.)
To pass a TestStand enumeration, choose Enumeration for the category of the parameter in the module panel. Then select a data type from the drop-down menu for the Enum Type control.
When specifying the expression for the parameter value, you can select an enumerator in thedrop-down menu, manually enter an enumerator constant, or specify an expression that evaluates to the required enumeration data type.
LabVIEW Adapter
You can create an Enum data type that maps to the LabVIEW enumerated parameter from an enumeration, ring control, or indicator by clicking on the Create/Update Custom Data Typebutton located in the Type column of the VI Parameter table next to any LabVIEW enumerated parameter or an enumerated array parameter.
This launches the Create/Update Custom Data Type from Enum Dialog Box, where you can create a custom Enum data type or update an existing Enum data type to match the LabVIEW parameter.
You can create an instance of the Enum data type and specify that variable in the Value column of the VI Parameter table.
When specifying string or Enum variables as the value of an enumerated parameter, the following table describes the behavior:
| TestStand Type | Variable Passed to a LabVIEW Input Parameter | Variable Receiving Data from a LabVIEW Output Parameter |
|---|---|---|
| String | If the variable's value exactly matches any of the LabVIEW enumerated parameter's elements,the numeric value of the element is passed to LabVIEW. If there is no match, you will get a run-time error. Assigning a duplicate (more than one element with the same name) enumerator name will result in an error. | If the numeric value received from LabVIEW matches any of the enumerated parameter's elements, then the matching element's name is stored in the string. If the numeric value does not match any element, its string representation surrounded by angular brackets is stored. Assigning a duplicate enumerator value to the string variable will result in an error. |
| CustomEnum data type | The elements of a TestStand Enum data type should match the LabVIEW parameter's enumerated elements exactly (both name and value). Any mismatch will result in an error. If the type matches,then the numeric value of the selected enum element is passed to LabVIEW. | The elements of a TestStand Enum data type should match the LabVIEW parameter’s enumerated elements exactly(both name and value). Any mismatch will result in an error. If the TestStand Enum data type is Strict, then the numeric value received from LabVIEW must match one of the enumerator elements. If there is no match, you will get a run-time error. |
.NET Adapter
There are three ways to pass enumeration parameters to the .NET adapter:
- Pass a TestStand string specifying the enumerator.
- Pass a TestStand number specifying the numeric value of the parameter.
- Pass a TestStand enumeration instance. (Requires TestStand 2016 or later.)
If passing a TestStand enumeration for a .NET enumeration parameter, the definition of the TestStand enumeration type should match the definition in the .NET code module. Specifically, the TestStand enumeration should define the same set of enumerators with the same numeric values as the code module. In addition, the numeric representation must match with the same requirements that apply to TestStand numbers. The name of the type is not important.
At edit time, the module panel will indicate if the definition of the TestStand enumeration specified does not match the definition in the code module. At run time, limited type checking is performed:
- If enumerator information is present in an enumeration instance used as an input parameter, the enumerators used by the instance must exist in the code module. Furthermore, the numeric value must match the value from the code module. (For flags enumerations, only the combined value is checked.)
- For both input and output parameters, the numeric representation of the TestStand enumeration must be compatible with the definition in the code module.
ActiveX/COM Adapter
There are two ways to pass enumeration parameters to the ActiveX/COM adapter:
- Pass a number specifying the numeric value of the parameter.
- Pass a TestStand enumeration instance. (Requires TestStand 2016 or later.)
If passing an enumeration for an ActiveX/COM enumeration parameter, the definitions of the TestStand enumeration type should match the definition in the type library for the code module. Specifically, the TestStand enumeration should define the same set of enumerators with the same numeric values as the code module. In addition, the numeric representation must be the default. The name of the type is not important.
At edit time, the module panel will indicate if the definition of the TestStand enumeration specified does not match the definition in the code module. At run time, limited type checking is performed:
- If enumerator information is present in an enumeration instance used as an input parameter, the enumerators used by the instance must exist in the code module. Furthermore, the numeric value must match the value from the code module. (For flags enumerations, only the combined value is checked.)
- For both input and output parameters, the numeric representation of the TestStand enumeration must be compatible with the definition in the code module.
- Use the TestStand Sequence Analyzer to find enumeration type mismatch errors in COM/ActiveX adapter steps.
- Many ActiveX/COM APIs expose enumerations in their type libraries, but still specify the long data type in method prototypes that expect these enumeration parameters. To pass a TestStand enumeration to such a method, convert it to a number using the appropriate expression function: Float64(), Int64(), or UInt64().