Jump to content

Control Value:Set fails for empty variant values.


mje

Recommended Posts

For the code below:

post-11742-0-16161600-1309196719_thumb.p

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.

Link to comment

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.

Link to comment

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

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.