LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variants: How to assign a new value without altering/losing its attributes?

Solved!
Go to solution

Hello,

 

I'm working with variant data with some metadata stored as attributes. The data values change frequently, but the metadata values are fairly constant.

 

I'm looking for a way to update the value of a variant while preserving its attributes (or equivalently, transfer the old attributes to a new variant). I know I can read the attributes from the old variant and insert them into the new one, but I'd imagine that doing this for many variants in a tight loop is wasteful of CPU cycles -- is that a valid concern? Is there a cleaner way to do this?

 

 

Thanks!

Certified LabVIEW Developer
0 Kudos
Message 1 of 3
(2,869 Views)

Use the "in place element structure" with the "variant to/from element border node". Seems to leave the attributes intact while changing the value of the variant.

0 Kudos
Message 2 of 3
(2,858 Views)
Solution
Accepted by topic author JKSH

Here's a quick and dirty example:

 

Download All
Message 3 of 3
(2,852 Views)