Error -17308 When Reading TestStand Enum via API

Updated Dec 4, 2018

Reported In

Software

  • TestStand
  • LabVIEW

Operating System

  • Windows

Programming Language

  • LabVIEW G

Issue Details

I try to read a TestStand enum variable via e.g. GetValVariant but I receive the following or similar error:

Error -17308 occurred at Expected type Number. Found type [...] in [...]
-17308; Specified value does not have the expected type.
Error in call to TestStand API member 'PropertyObject.GetValVariant'.
Expected type Number.  Found type Enum.


How can I read an enum value using the TestStand API?

Solution

To read an enum variable via e.g. GetValVariant you need to set the options parameter to PropOption_CoerceFromEnum or the hex equivalent C0. For example:

FileGlobals.GetValVariant("MyEnum",PropOption_CoerceFromEnum)

This statement reads a Enum FileGlobal named "MyEnum" as a variant.

Additional Information

A list of all possible options can be found under PropertyOptions Constants

WAS THIS ARTICLE HELPFUL?

Not Helpful