Neil Pate Posted September 27, 2016 Report Share Posted September 27, 2016 I have a variant, for some reason it does not seem to have it's type information inside, the variant thinks it contains a variant (which I don't believe it does). I cannot do anything about this, this is how it is being handed to me. Does anybody know how I can retrieve the original data type? (do not really need to know specifics of SGL or DBL etc, just want to know it is an array). In the example attached I know this particular variant is an SGL array, so the Variant-->Data works fine as I have manually put in the type. However I am expecting various different array types. Variant Trouble.vi Quote Link to comment
hooovahh Posted September 27, 2016 Report Share Posted September 27, 2016 Using the Variant to data, turn it into an array of variants. If it returns no error, then your input is either an array, or a cluster. This trick can also turn a cluster into an array of variants so you'll need to check for that too. Maybe check to see that all the data types of the output are the same? But even that isn't a guarantee. How did you end up with an array that thinks it is a variant? Maybe there is an unnecessary To Variant in there some where. 1 Quote Link to comment
Neil Pate Posted September 27, 2016 Author Report Share Posted September 27, 2016 2 minutes ago, hooovahh said: How did you end up with an array that thinks it is a variant? Courtesy of the OPC-UA API that comes with the DSC toolkit. I did try to check for a variant in a variant, but it seemed to keep going down the rabbit hole. I will try the variant to array of variants I do use this elsewhere. At the moment this is getting me out of jail, but it feels wrong on so many levels. The OPC-UA toolkit kindly tells me what the data type is, it just does not bother putting that into the variant. Quote Link to comment
Neil Pate Posted September 27, 2016 Author Report Share Posted September 27, 2016 This is all part of my master-plan (insert evil voice) to use a variant repository for my across-loop data sharing experiement. Currently I am making a nice tree viewer for the variant attributes (kinda like Ton's XControl) and mostly based on this. Quote Link to comment
Neil Pate Posted September 27, 2016 Author Report Share Posted September 27, 2016 21 minutes ago, hooovahh said: Using the Variant to data, turn it into an array of variants. If it returns no error, then your input is either an array, or a cluster. Bingo! Seems to work. I think all my clusters will be properly named as they will come from my code, it is only the arrays which come from the OPC-UA toolkit that may have this problem. 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.