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.
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.
06-23-2021 05:43 AM - edited 06-23-2021 06:18 AM
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 Locals.Color.GetValNumber("", PropOption_CoerceFromEnum)
.
Only 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).
To have GetValString
working I need to manualy select enum value in variables pane (so the curly brackets change into square brackets).
EDIT:
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.
06-24-2021 10:29 AM
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.
06-24-2021 11:43 PM - edited 06-24-2021 11:44 PM
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.
07-02-2021 03:36 AM
Simply use
Locals.Color.GetValString("",PropOption_Coerce)
or
Str(Locals.Color)
07-03-2021 11:32 AM
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.