I checked TestStand 2019 (32-bit)\Examples\Fundamentals\Using TestStand Enumerations\LabVIEW\Using TestStand Enumerations.seq example.
I tried to get enum string and value in watch window using
Locals.Color.GetValString("", PropOption_CoerceFromEnum) and
GetValNumber works. Why I can't get enum string this way? According to the documentation I should be able to accomplish this with flag PropOption_CoerceFromEnum (Use this option for implicit conversion when using an enumeration value as a string or number. You can use this option with the PropertyObject.GetValNumber and PropertyObject.GetValString methods).
GetValString working I need to manualy select enum value in variables pane (so the curly brackets change into square brackets).
I was able to get enum string with
Locals.MyEnum.Enumerators.GetPropertyObjectByOffset(Locals.MyEnum.GetValNumber("", PropOption_CoerceFromEnum), PropOption_NoOptions).GetValString("", PropOption_CoerceFromEnum) but this will work only if
MyEnum values are
Enumerators offset indices.
Solved! Go to Solution.
My understanding is that the CoerceFromEnum option works for only TS Enums and not for LV Enums, I believe the reason is simple as TS has access to only TS ENUM definitions to translate the ENUMS to String but not the LV side.
I tried this with other adapters and the problem appears with all of them (so I should correct this thread title).
Anyway, we are not talking about LabVIEW enums. You can see on the screen that the value from the adapter is properly converted to the TestStand variable. What's more GetValNumber works with this propo as expected.
It works. So, why does
PropOption_Coerce (I think it is actually
PropOption_CoerceFromNumber OR PropOption_CoerceToString) work and
PropOption_CoerceFromEnum not? This is strange.