mje Posted June 27, 2011 Report Share Posted June 27, 2011 For the code below: The invoke node fails with Error 1 on me when I execute the "Variant" case. That is Control Value:Set doesn't seem to be able to apply an empty variant to the control. This strikes me as a bug, or is there some esoteric reason this is an intended behavior? LV2010 SP1. Quote Link to comment
TomOrr0W Posted June 27, 2011 Report Share Posted June 27, 2011 I don't know if it is expected or not, but the same thing happens with variant to data (in LabVIEW 8.5, at least). Quote Link to comment
Jarrod S Posted June 28, 2011 Report Share Posted June 28, 2011 You might see what happens if you do a variant constant wired to a To Variant wired to this invoke node. That would probably work. The invoke node probably wants to treat the incoming data as a variant wrapping the actual data type of the control. An empty variant does not wrap the variant data type, it wraps void. Quote Link to comment
TomOrr0W Posted June 28, 2011 Report Share Posted June 28, 2011 You might see what happens if you do a variant constant wired to a To Variant wired to this invoke node. That would probably work. The invoke node probably wants to treat the incoming data as a variant wrapping the actual data type of the control. An empty variant does not wrap the variant data type, it wraps void. Using To Variant does prevent the error (at least in LabVIEW 8.5). The following values are what ends up in the indicators in my first post: In Variant (showing type and data): 'Value': Variant <Variant : Empty> In data (showing type and data): '': void Quote Link to comment
mje Posted June 28, 2011 Author Report Share Posted June 28, 2011 Brilliant! Thanks folks. It all works, but... What confuses me is this seems to be adding another layer of wrapping to the variant. When I used to run the code from my original post with the "Long" enumeration selected, I'd get a value of 0 in the Variant indicator. But when I add the To Variant primitive, I now get <Variant: 0>. Does this mean I essentially have a doubly wrapped variant in this case (A variant of a variant of a long)? I believe Tom might have been getting at this point as well. That's all fine and well, but what I find surprising is the code I have downstream in my real use case still works: I have a single Variant To Data primitive, which somehow resolves the doubly wrapped variant data type when I pass through a real bit of data. So that's all good I guess? Either way, things seem to work with the To Variant primitive added, though I can't say it's as I expect. I'm still of the school the invoke node should be able to apply the void type to the indicator as I have no problem passing voids through VIs if I'm not invoking get/set methods through VI server. 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.