06-03-2013 02:02 PM - edited 06-03-2013 02:09 PM
Suppose I have a variant from an external source.
Further suppose I know the data type, but I do NOT know the attributes and their values (if any).
Is it possible to directly change the value of the variant, "under the hood" so to speak, and leave all the attributes intact?
I realize I can read all the attributes, generate a new variant with my new data and write them all back, but that seems highly inefficient.
Casting new data to a variant, then using Variant to Data to convert that to the Original variants type seems to work as well. Again, kludgy.
Poking around with "..vi.lib\Utility\VariantDataType\*.* but so far not finding a 'direct' method.
Thanks!
Solved! Go to Solution.
06-03-2013 04:39 PM
You can use the inplace element structure to set the value of an existing variant. It will preserve any existing attributes.
06-03-2013 04:55 PM
@CMal wrote:
You can use the inplace element structure to set the value of an existing variant. It will preserve any existing attributes.
That's good information to know. I know I'll run into that situation one of these days.
06-03-2013 09:01 PM
Brilliant!
Didnt' occur to me to check if in-place would take a variant. Seems obvious now. Thanks! :manvery-happy:
06-03-2013 09:53 PM
Then you should mark C-mal's post as the solution to your question rather than your own thank you message. You will need to go to the options menu to the upper right of your message to unmark it as the solution.
06-10-2013 09:17 AM
Oops - my bad. Thanks for the heads up. Credit where it's due, no doubt.
11-07-2022 02:21 AM
Does it keep the attributes if you use an in place element structure with maps? Maybe I made a mistake, but directly replacing the new value of the variant drops the attributes, I had to go thru all the attributes of the existing value and write them to the new one. Again, could be my mistake.
11-07-2022 03:12 AM
Hi,
I think you need a second 'In Place Element Structure' with a 'Variant To / From Element border node' working on your variant.