george seifert Posted November 4, 2009 Report Share Posted November 4, 2009 How can I get the 'Info' data contained in a variant? I want to get the variable type of the elements in an array. For example, I used the GetArrayInfo VI to get the following info from my array and want to extract the U32 info contained in it. George Quote Link to comment
ShaunR Posted November 4, 2009 Report Share Posted November 4, 2009 How can I get the 'Info' data contained in a variant? I want to get the variable type of the elements in an array. For example, I used the GetArrayInfo VI to get the following info from my array and want to extract the U32 info contained in it. George If you use the "variant to flattened string" function, it has a type output array. Quote Link to comment
jzoller Posted November 4, 2009 Report Share Posted November 4, 2009 (edited) For simple types, you can use <LV>\vi.lib\Utility\VariantDataType\GetTypeInfo.vi. There are other useful bits in that folder, too. I wish they'd put some of these on the default palette... it always takes me a few minutes to remember where they are! Joe Z. Edit: "On closer inspection...". Of course, ShaunR's answer is more correct for your question. Sorry, I'm not used to this side of the AM/PM Edited November 4, 2009 by jzoller Quote Link to comment
george seifert Posted November 4, 2009 Author Report Share Posted November 4, 2009 For simple types, you can use <LV>\vi.lib\Utility\VariantDataType\GetTypeInfo.vi. There are other useful bits in that folder, too. Joe Z. Edit: "On closer inspection...". Of course, ShaunR's answer is more correct for your question. Yeah, I think ShaunR got it. The GetTypeInfo VI doesn't return the Info data within the variant that I wanted. It returns the overall type of data within the variant - like Enum or Array. George Quote Link to comment
Aristos Queue Posted November 4, 2009 Report Share Posted November 4, 2009 Yeah, I think ShaunR got it. The GetTypeInfo VI doesn't return the Info data within the variant that I wanted. It returns the overall type of data within the variant - like Enum or Array. All of the info in the variant's type should be accessible through the VIs in the same folder as GetTypeInfo. In fact, GetTypeInfo should have returned "int32" to you. Isn't that the info you wanted? If there's some aspect of the variant that you can't get from the VIs in that directory, I'd be surprised, since those are the type handling VIs that we in R&D created to manipulate all the types from G. They should be as rich as anything I can get access to in the C++ code. Quote Link to comment
george seifert Posted November 4, 2009 Author Report Share Posted November 4, 2009 All of the info in the variant's type should be accessible through the VIs in the same folder as GetTypeInfo. In fact, GetTypeInfo should have returned "int32" to you. Isn't that the info you wanted? If there's some aspect of the variant that you can't get from the VIs in that directory, I'd be surprised, since those are the type handling VIs that we in R&D created to manipulate all the types from G. They should be as rich as anything I can get access to in the C++ code. I ended up using the GetArrayInfo VI to get the data for one element of the array. From there I got type descriptor string from the Variant to Flattened String. I fed the type descriptor to the Get Type Code from I16 Array VI which gave me the element type that I wanted. George Quote Link to comment
Aristos Queue Posted November 4, 2009 Report Share Posted November 4, 2009 I ended up using the GetArrayInfo VI to get the data for one element of the array. From there I got type descriptor string from the Variant to Flattened String. I fed the type descriptor to the Get Type Code from I16 Array VI which gave me the element type that I wanted. Post a block diagram, please. There has to be a simpler way to do this. Quote Link to comment
Ton Plomp Posted November 5, 2009 Report Share Posted November 5, 2009 The OpenG library has an extensive set of VIs to deal with variant data. With these set of VIs I have written a variant probe/XControl: Ton 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.