LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variant to Data Object "memory"

Solved!
Go to solution

I ran into a bit of odd behavior today, and was wondering if this had been observed by others and as a quick sanity check...

 

It seems like a "bug" to me, but it's not always clear if behavior is actually intended or not...

 

It looks like the "Variant to Data" node shows a buffer/memory type behavior with regard to objects.

 

What I mean by that is that if (in a for loop) you send a Object through a Variant to Data node in one iteration, and then in the second iteration you send an incompatible data type through the same node, rather than the output being the default data type, the output is actually the previous instance of the object... 

 

Below is an screenshot of a VERY simple example where this behavior is observed.  I've also attached a .zip file with the example code (LV 2018).  When we try this with a "standard" data type (ie a string) the output is the default value (blank string).  With the class, it is the last instance of the class to pass through.

 

In both cases the error cluster still passes through the same error, so the case can clearly be handled correctly.  However if this error is suppressed somewhere, the results could be pretty nonsensical/confusing...

image.png

image.png

Message 1 of 5
(2,856 Views)
Solution
Accepted by topic author jyoung8711

Thanks for reporting this, jyoung8711

 

I tried your project in LabVIEW 2019 and it shows the same behavior you are seeing. I wasn't sure it was a bug, but after enabling Iteration Parallelism in the inner loop and getting inconsistent behavior (sometimes using the default object and sometimes not), I concluded it does seem as an oversight.

 

Therefore, I have filed CAR #743825 for the appropriate team to review and follow-up with this.

 

Thanks,

Message 2 of 5
(2,836 Views)

There's no 'Default' data in Variant to data, only conversion attempt. What you found is clearly a bug, but it also shows the importance of checking error wire, and if you want a default value, wire through the conversion data through a case structure.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 5
(2,750 Views)
Solution
Accepted by topic author jyoung8711

This issue will be fixed in LV 2020.

0 Kudos
Message 4 of 5
(2,550 Views)

@AristosQueue (NI) wrote:

This issue will be fixed in LV 2020.


Great!! Thanks for the update.

0 Kudos
Message 5 of 5
(2,496 Views)