heiko Posted October 19, 2006 Report Share Posted October 19, 2006 Hi, i am trying to programmatically create an array of variant which should be able to contain dynamic content. Because I want to query specific data from that variant later on I need to name every item. I tried to do it with the SetTypeInfo VI but unfortunately it overwrites the data contained in the variant. Does anyone know another solution? I'll attach a demo which demontrates this behaviour. btw. I left out the array in this demo. cheers Heiko Download File:post-6437-1161269090.vi Quote Link to comment
JDave Posted October 19, 2006 Report Share Posted October 19, 2006 i am trying to programmatically create an array of variant which should be able to contain dynamic content. Because I want to query specific data from that variant later on I need to name every item. I tried to do it with the SetTypeInfo VI but unfortunately it overwrites the data contained in the variant. Does anyone know another solution? First off, the SetTypeInfo VI is expecting a Type Descriptor as input, not a data variant as you are intending. Secondly, there is a wonderful option for what you are envisioning. It is using the Attributes of a variant. You can set a variant attribute by name and then retrieve it later by name in your program. And it is quite fast for 8.0 and up. Check it out. Quote Link to comment
LAVA 1.0 Content Posted October 19, 2006 Report Share Posted October 19, 2006 I tried to do it with the SetTypeInfo VI but unfortunately it overwrites the data contained in the variant. Does anyone know another solution? Try the Variant Set and Get Attribute functions Download File:post-949-1161273727.vi Quote Link to comment
heiko Posted October 20, 2006 Author Report Share Posted October 20, 2006 First off, the SetTypeInfo VI is expecting a Type Descriptor as input, not a data variant as you are intending. Thanks for the reply it brought me a lot of new ideas. I already saw that get/set attribute stuff, but was not using it because initially i wanted to automatically serialize my wires using GetTypeInfo and a case structure to format the data into a string like this "name=value". So i though it would be the most elegant way if i could just recreate that wire with its name. But it seems that there is still no way of programatically naming wires during run time. Anyway this variant attribute stuff looks like it is a good hack for doing 'item' => 'value' lookups (similar to hashes in perl). :thumbup: cheers heiko Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.