I ran into an unexpected result when using "Variant to Data" vi. As I understand, the Variant to Data vi will output the default value of data type wired in "type" terminal when an error occurred before this vi. With this understanding, I think the output result of following vi is an array with element "100" and "0".
However, I got an unexpected array with element "100" and "100" (LabVIEW 2014). It seems like that the "Variant to Data" vi output the result of previous successful execution when an error exists in "error in" terminal.
Is there something I misunderstand about "Variant to Data" vi??
Thank for any help you can provide.
Tried the same in 2015 i am getting 100,0
Found the same issue when using Case.
Without case structure it gives proper result.
I believe you slightly misunderstood the Help message. It says "
|If variant could not be converted to the data type specified, this data returns the default value for the data type.|
It does not say this happens if there is an Error on Error In. Many (most?) LabVIEW functions will, indeed, not run and return Default Values on Error In, but Variant to Data is only doing "data re-interpretation", for example re-interpreting a 32-bit bit pattern, read in as a U32, as a Sgl (which also takes 32 bits). Since no "computation" is being done, the LabVIEW Development Team probably concluded that this wouldn't be a problem. The only time there would be a problem is if you tried to convert it to a bit-incompatible data type, like a U32 to a 64-bit Dbl.
Same Functionality when addressing in different ways (with and without case structure gives different output)
Reproduced in 2016, but not in 2018.
I want to say that this issue was discussed in a private board. The issue there was specific to classes, but it was acting similar to this. I think the issue was fixed in either 2017 SP1 or 2018.
Issue Reproduced in LV2017