From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble passing values to subpanels

I seem to be having issue pass values to my sub VIs in a subpanel.  I'm using the invoke node and control value set command.

 

I am able to pass a database reference that I'm using, but when I try Boolean values, I get no response.  I'm also trying to use one of the Boolean values to fire an event.  The front panel of my sub VI looks as though the FP button is being pressed, but my value doesn't change and my event doesn't fire.

 

I've reviewed as may forum threads as I could and have looked through the bug reports without any luck.  Any ideas?

0 Kudos
Message 1 of 9
(3,949 Views)

Attached your vi, so that we can look at it.  Have you tried to change the mechanical action of your boolean to switch instead of latch?  That may help.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 9
(3,930 Views)

Hi Clampy,

      This boolean/signalling problem sounds familier - is the button's mechanical-action "latched" (and value property variant type)?  If so, try changing button action to not be latched.

 

Luck/Cheers.

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 3 of 9
(3,923 Views)

Thanks guys.  No luck though.  I did have the mechanical action set to latch when released.  Changing it to switch w/r had no effect.

 

Here is a side question for anyone:  Why does the "latch" only switch the value momentarily, but "switch" holds the value until changed again?  In all my years working w/ LV I never under stood that and just accepted it.  Why did NI decide to title those actions exactly opposite of what most normal humans would interpret that as being?

 

Now back to the subpanels, In one instance I'm trying to pass a boolean constant, so I wouldn't expect that to have any effect on what so ever.

 

The other thing I though of is that I'm passing my reference before starting the sub VI, and then trying to pass both my booleans after.  I'll try reversing that to see if it works momentarily, but if that is the case, it seems that there is no way to interact data with the running VI then. That limits the usefulness of subpanels even further.

 

I'll try to post the code snippet here shortly.

0 Kudos
Message 4 of 9
(3,905 Views)

Also tbd, what do you mean by       "(and value property variant type)?"

 

Do I need to convert the boolean to a variant before passing it?

0 Kudos
Message 5 of 9
(3,902 Views)

If you want to fire an event in the subpanel, you need a reference to the boolean control in the subpanel.  Use the "value signaling" method to fire your event, if you pass using the VI refnum and control set, it will not fire the event!  

 

Depending on the latch type, the value signaling will be a variant in which case, you cannot fire the event.  You have to use one of the latch modes, then the value signaling is a boolean data type and then your good to go.

 

Hope this helps.


Paul
0 Kudos
Message 6 of 9
(3,898 Views)

Tried a couple things with some of you suggestions, no solution yet.

 

Attached is my code.

 

How do you pass a ref to the sub panel?  Correct me if I am wrong, but isn't the subpanel essentially an invoke node?  LV won't let me wire a ref to the control to the subpanel invoke node.  Can you elaborate on your recomendation?

0 Kudos
Message 7 of 9
(3,891 Views)

attached is the code snippet.   You can use this as a subVI in place of where you are setting the control value or just hammer the code in directly.  Add error handling as you see fit, although you should note that if you use the error handling within the for loop, you will probably get an error, probably better to move the 'to specific' outside the loop.

 

 

setCtrlValSignal.png


Paul
0 Kudos
Message 8 of 9
(3,880 Views)

Got the variable name wrong in the example.  you will need to change it.  Sorry


Paul
0 Kudos
Message 9 of 9
(3,871 Views)