Example code attached.
I'm using a LabVIEW variant as a lookup table by using the attributes (see here: https://decibel.ni.com/content/docs/DOC-25371 (and others)). It works well. When I attempt to pass this variant from one TestStand step to another, I lose the attributes of the variant. I've made a small example to demonstrate this. Am I doing something wrong? Why does the variant retain the value, but not the attributes? Should I store this as another type in TestStand? In the documentation for LabVIEW types in TestStand, it is claimed that a Variant in LabVIEW maps to "Anything" in TestStand. When I tried to use a Boolean, however, I got an error and was instructed to use a Container. Does that container need to have some specific suptype to retain the attributes? Or does it have nothing to do with that?
Thanks in advance
Here is an excerpt from the NI Product Support Engineer's response on this issue:
"Unfortunately, this is a known limitation with LabVIEW variants in TestStand. When LabVIEW variant data is returned to TestStand from a LabVIEW code module, the data overwrites the property. TestStand does not have a mechanism to "fit" the returned variant data to the TestStand type, so unfortunately you will need to either remap the data to the type, or use a cluster rather than a variant."
Essentially, it appears that variant data can not be guaranteed to work properly in TestStand. In order to ensure you have your data passed from your Code Modules correctly, I would recommended following the Product Support Engineer's advice of remapping or clustering the data. If this is not possible, the Flatten Variant to String.vi could be an alternative to try. I was able to confirm that this has not been fixed with TestStand 2014 either.
Typecasting LabVIEW Variants in TestStand Forum Post:
I hope this helps!
Good to know I'm not just doing something silly. This is unfortunate, because one of the most useful things I've found with the variant is the variant attributes as a hash table.
I've come up with my own workaround, which is to pass the variant by DVR from one TestStand Step to another (using a Sequence Local). A DVR to teststand is just a numeric type. Then, there is no loss of information when the second VI uses an in place structure to get at the variant via the DVR. Maybe this will help others hoping to do the same.